Next.js Image Optimization on Vercel: How to Avoid Hitting the Free Plan Limit
Cross the Hobby image limit on Vercel and your users get alt text instead of pictures. Here is where the transformations actually come from, and the next.config.js and sizes changes that cut them down.

When a Hobby project goes over its image allowance, Vercel doesn’t send you a bill. A new optimization returns an HTTP 402 instead of an image, which fires the onError callback and renders your alt text. Your visitors see broken images and your layout shifts. You find out from a screenshot a friend sends you, or from nothing at all.
I’ve seen this catch people who thought their site was small. The limit isn’t about how many images you have. It’s about how many versions of them get generated.
What the free plan gives you
Per month, Hobby includes 5K image transformations, 300K cache reads, and 100K cache writes. The one that bites is transformations. You’re charged a transformation for every cache MISS and every STALE revalidation. A cache hit costs you a read, which is cheap. A miss costs a transformation and a write.
Vercel never bills a Hobby team on demand, so you can’t run up a surprise invoice. You just run out. In most cases you wait 30 days before the feature works again. Also, Hobby is restricted to non-commercial, personal use. If a client’s site is hitting this limit, the fix is a Pro plan, not a clever config.
Where the transformations come from
Vercel’s own guide says three things drive the meters: how many distinct transformations exist, how big the transformed files are, and how long they stay cached. I’d start with the first, because it multiplies.
Every unique combination of source image, width, quality, and format is its own transformation. One hero image requested at four widths in two formats is eight. A product grid of 100 images, each requested at six widths in two formats, is 1,200. Three of those pages and you’ve used most of your month before anyone has bought anything.
Nobody sees the multiplication happening. You write one <Image> tag.
Drop AVIF unless you can afford it
The formats option defaults to WebP only. Adding AVIF doubles the transformations and cache entries for every image. That’s the cleanest cut available. AVIF files are often smaller than WebP, but on the free plan that saving costs you half your budget. I leave AVIF off on Hobby projects. Keep it for a Pro project where bandwidth matters more than the invoice line.
// next.config.js
module.exports = {
images: {
formats: ['image/webp'],
},
}
Trim the width list
Next.js generates candidate widths from deviceSizes and imageSizes. The defaults cover everything from small phones to 4K screens: 640, 750, 828, 1080, 1200, 1920, 2048, 3840 for devices, plus a list of smaller sizes for fixed-width images. Real traffic spreads across many of those, and each one that gets requested for a given image is a new transformation.
You rarely need that many. Four device widths and three small sizes is enough for most marketing sites and blogs:
images: {
formats: ['image/webp'],
deviceSizes: [640, 828, 1200, 1920],
imageSizes: [64, 128, 256],
qualities: [75],
minimumCacheTTL: 2678400, // 31 days, in seconds
}
The trade-off is that browsers pick the next size up, so someone on a 1000px viewport downloads the 1200px image. A slightly heavier file in exchange for fewer variants is a good deal on a free plan.
I’d also pin qualities to a single value. If different components pass different quality props (one at 80, one at 60, one at 90), you’ve created separate variants of the same image for no visible reason. Pick 75 and stop.
Set the sizes prop
This is the one people skip. Without sizes, the browser has no idea how wide your image will be on the page, so Next.js falls back to broad defaults. Tell it. A card in a three-column grid that’s about a third of the viewport on desktop and full width on mobile looks like this:
<Image
src={product.image}
alt={product.name}
fill
sizes="(min-width: 1024px) 33vw, 100vw"
/>
Now the browser asks for a width that makes sense, and you stop generating the 1920px version of a 400px thumbnail. If you use fill and forget sizes, expect the worst-case list. I’d check every fill image in a codebase before touching anything else.
Raise the cache lifetime
Every STALE revalidation costs a transformation. If your cache lifetime is short, images expire and get re-transformed even though nothing changed. Vercel’s guide treats TTL as one of the three main drivers, and a project where cache writes run at or above reads is a warning sign that you’re creating transformations nobody reuses.
Set minimumCacheTTL to something long (the config above uses 31 days). This only works if your image URLs change when the image changes. If you overwrite hero.jpg in place and expect it to update, a long TTL will bite you. Version the filename, or purge the cache after a swap. For a blog or a portfolio, where images almost never change, a long TTL is nearly free.
Remote images and query strings
Images served from a CMS or a storage bucket are where I’d look first when the numbers don’t add up. The cache key for remote images is built from the URL, so if your CMS appends a changing query parameter (a timestamp, a signed token, a version hash that rotates), you get a new cache entry on every request. Same picture, new transformation each time.
Look at the actual src values your pages are producing, in the browser’s network tab. If the query string changes between page loads, strip it out or switch to a stable URL. Signed URLs with short expiry are the usual culprit.
Know when to stop optimizing through Vercel
Some projects just have too many images. A photo gallery, a store with a few hundred products, a site where users upload their own pictures. Tuning the config will help, but you’ll still be shipping a lot of distinct images through a 5K monthly allowance.
My preference in that case is to optimize before deploy. Run sharp over your images at build time, write the sizes and format you want to public/, and mark them unoptimized so Next.js serves them as they are:
<Image src="/photos/cabin-800.webp" alt="Cabin" width={800} height={533} unoptimized />
You lose automatic responsive sizing, so you generate the two or three widths yourself. For a fixed set of images that’s a one-time script. For user uploads, I’d send them to a dedicated image service (Cloudinary, ImageKit, Cloudflare Images) and use a custom loader. Those have their own free tiers and their own limits, so read them before committing.
Don’t set images.unoptimized: true globally and call it fixed. That turns off resizing for everything, and a 4MB hero straight from a camera will hit your visitors at full weight. Opting out is fine only if you’ve already resized the files yourself.
Check before you guess
The Vercel dashboard has an Observability view for image optimization. The goal after any change is a lower transformation count and cache reads growing relative to cache writes. Watch it for a few days after you deploy config changes. Guessing which of the fixes above mattered is a waste of time when the dashboard tells you.
If you’re already at the limit and don’t know why, work in this order: remove AVIF, add sizes to every fill image, trim deviceSizes, raise the TTL, then check remote URLs for changing query strings. Most projects I’d expect to drop well under 5K from the first three alone.
And if the site earns money, pay for Pro. It’s the honest answer.