Skip to Content

Image Optimization with Vercel

all plans


Vercel supports dynamically transforming unoptimized images to reduce the file size while maintaining high quality. These optimized images are cached on the Vercel CDN, meaning they're available close to users whenever they're requested.

Get started

Image Optimization works with many frameworks, including Next.js, Astro, and Nuxt, enabling you to optimize images using built-in components.

Benefits of image optimization

Optimizing images on Vercel provides several advantages for your application:

  • Reduces the size of images and data transferred, enhancing website performance, user experience, and Fast Data Transfer usage.
  • Improving Core Web Vitals, reduced bounce rates, and speeding up page loads.
  • Sizing images to support different devices and use modern formats like WebP and AVIF.
  • Optimized images are cached after transformation, which allows them to be reused in subsequent requests.

How Image Optimization works

The flow of image optimization on Vercel involves several steps, starting from the image request to serving the optimized image.

  1. The optimization process starts with your component choice in your codebase:
    • If you use a standard HTML img element, the browser will be instructed to bypass optimization and serve the image directly from its source.
    • If you use a framework's Image component (like next/image) it will use Vercel's image optimization pipeline, allowing your images to be automatically optimized and cached.
  2. When Next.js receives an image request, it checks the unoptimized prop on the Image component or the configuration in the next.config.ts file to determine if optimization is disabled.
    • If you set the unoptimized prop on the Image component to true, Next.js bypasses optimization and serves the image directly from its source.
    • If you don't set the unoptimized prop or set it to false, Next.js checks the next.config.ts file to see if optimization is disabled. This configuration applies to all images and overrides the individual component prop.
    • If neither the unoptimized prop is set nor optimization is disabled in the next.config.ts file, Next.js continues with the optimization process.
  3. If optimization is enabled, Vercel validates the loader configuration (whether using the default or a custom loader) and verifies that the image source URL matches the allowed patterns defined in your configuration ( remotePatterns or localPatterns).
  4. Vercel then checks the status of the cache to see if an image has been previously cached:

When to use Image Optimization

Image Optimization is ideal for:

  • Responsive layouts where images need to be optimized for different device sizes (e.g. mobile vs desktop)
  • Large, high-quality images (e.g. product photos, hero images)
  • User uploaded images
  • Content where images play a central role (e.g. photography portfolios)

In some cases, Image Optimization may not be necessary or beneficial, such as:

  • Small icons or thumbnails (under 10 KB)
  • Animated image formats such as GIFs
  • Vector image formats such as SVG
  • Frequently changing images where caching could lead to outdated content

If your images meet any of the above criteria where Image Optimization isn't beneficial, we recommend using the unoptimized prop on the Next.js Image component. For guidance on SvelteKit, Astro, or Nuxt, see their documentation.

It's important that you are only optimizing images that need to be optimized otherwise you could end up using your image usage quota unnecessarily. For example, if you have a small icon or thumbnail that is under 10 KB, you shouldn't use Image Optimization as these images are already small and optimizing them further wouldn't provide any benefits.

Setting up remote or local patterns

An important aspect of using the Image component is properly setting up remote/local patterns in your next.config.ts file. This configuration determines which images are allowed to be optimized.

You can set up patterns for both local images (stored as static assets in your public folder) and remote images (stored externally). In both cases you specify the pathname the images are located at.

Local images

A local image is imported from your file system and analyzed at build time. The import is added to the src prop: src={myImage}

Setting up local patterns

To set up local patterns, you need to specify the pathname of the images you want to optimize. This is done in the next.config.ts file:

localPatterns: [

{

images: {

exportdefault nextConfig;

importtype { NextConfig } from'next';

],

},

},

search:'',

constnextConfig:NextConfig= {

pathname:'/assets/images/**',

See the Next.js documentation for local patterns for more information.

The cache key for local images is based on the query string parameters, the Accept HTTP header, and the content hash of the image URL.


  Local images cache key

  • Cache Key:
    • Project ID
    • Query string parameters:
      • q: The desired quality of the transformed image, between 1 (lowest quality) and 100 (highest quality).
      • w: The desired width (in pixels) of the transformed image.
      • url: The URL of the source image. For local images (/assets/me.png) the content hash is used instead (3399d02f49253deb9f5b5d1159292099).
    • Accept HTTP header (normalized).
  • Local image cache invalidation:
    • Redeploying your app doesn't invalidate the image cache.
    • To invalidate, replace the image of the same name with different content, then redeploy.
    • You can also manually purge or programatically purge to invalidate all cached transformations of a source image without redeploying.
  • Local image cache expiration: Cachedfor up to 31 days on the Vercel CDN.

Remote images

A remote image requires the src property to be a URL string, which can be relative or absolute.

Setting up remote patterns

To set up remote patterns, you need to specify the hostname of the images you want to optimize. This is done in the next.config.ts file:


images: {


remotePatterns: [

{

protocol:'https',

port:'',

hostname:'example.com',

importtype { NextConfig } from'next';

],

},

exportdefault nextConfig;

search:'',

constnextConfig:NextConfig= {

pathname:'/account123/**',

In the case of external images, you should consider adding your account id to the pathname if you don't own the hostname. For example pathname: '/account123/v12h2bv/**'. This helps protect your source images from potential abuse.

See the Next.js documentation for remote patterns for more information.

Remote images cache key

The cache key for remote images is based on the query string parameters, the Accept HTTP header, and the content hash of the image URL.

  • Cache Key:
    • Project ID
    • Query string parameters:
      • q: The desired quality of the transformed image, between 1 (lowest quality) and 100 (highest quality).
      • w: The desired width (in pixels) of the transformed image.
      • url: The URL of the source image. Remote images use an absolute url (https://example.com/assets/me.png).
    • Accept HTTP header (normalized).
  • Remote image cache invalidation:
    • Redeploying your app doesn't invalidate the image cache
    • You can manually purge or programatically purge to invalidate all cached transformations of a source image without redeploying.
    • Alternatively, you can configure the cache to expire more frequently by adjusting the TTL.
  • Remote image cache expiration:TTL is determined by the Cache-Control max-age header from the upstream image or minimumCacheTTL config (default: 3600 seconds), whichever is larger.

Once an image is cached, it remains so even if you update the source image. For remote images, users accessing a URL with a previously cached image will see the old version until the cache expires or the image is invalidated. Each time an image is requested, it counts towards your Fast Data Transfer and Edge Request usage for your billing cycle.

See Pricing for more information, and read more about caching behavior in the Next.js documentation.

Image Transformation URL format

When you use the Image component in common frameworks and deploy your project on Vercel, Image Optimization automatically adjusts your images for different device screen sizes. The src prop you provided in your code is dynamically replaced with an optimized image URL. For example:

  • Next.js: /_next/image?url={link/to/src/image}&w=3840&q=75
  • Nuxt, Astro, etc: /_vercel/image?url={link/to/src/image}&w=3840&q=75

The Image Optimization API has the following query parameters:

  • url: The URL of the source image to be transformed. This can be a local image (relative url) or remote image (absolute url).
  • w: The width of the transformed image in pixels. No height is needed since the source image aspect ratio is preserved.
  • q: The quality of the transformed image, between 1 (lowest quality) and 100 (highest quality).

The allowed values of those query parameters are determined by the framework you're using, such as next.config.js for Next.js.

If you aren't using a framework that comes with an Image component or you're building your own framework, refer to the Build Output API to see how the build output from a framework can configure the Image Optimization API.

Opt-in

To switch to the transformation images-based pricing plan:

  1. Choose your team scope on the dashboard, and go to Settings, then Billing
  2. Scroll down to the Image Optimization section
  3. Select Review Cost Estimate. Proceed to enable this option in the dialog that shows the cost estimate.

View your estimate

Image optimization from the CLI

The use case above is request-driven: images are transformed when a browser requests them through your deployment's public API. You can also optimize an image once at write time and store the result in Vercel Blob, without a deployed app or allowlist configuration:

  • From the terminal, run vercel blob put-image. The command prints the URL of the stored image to stdout, so scripts and agents can read the result back.
  • In code, call putImage() from the @vercel/blob SDK.

Only the optimized output is stored, and the stored image is served like any other blob. Each write is billed as one image transformation plus a regular blob upload at standard Vercel Blob pricing. Serving the stored image doesn't use Image Optimization and doesn't incur transformation charges.

You can reach our customer support team by emailing info@yourcompany.example.com, calling +1 555-555-5556, or using the live chat on our website. Our dedicated team is available 24/7 to assist with any inquiries or issues.

We’re committed to providing prompt and effective solutions to ensure your satisfaction.

We offer a 30-day return policy for all products. Items must be in their original condition, unused, and include the receipt or proof of purchase. Refunds are processed within 5-7 business days of receiving the returned item.

Last updated August 13, 2026

Cross-link map: Image Optimization with Vercel (/docs/image-optimization)From the Vercel docs graph (built 2026-09-21T05:26:59.511Z), spanning vercel.com docs + KB, nextjs.org, ai-sdk.dev, and other Vercel documentation sites. Full graph as JSON: https://vercel.com/docs/graph.jsonSemantically closest pagesHow to reduce Vercel Image Optimization costs — Learn how to reduce Vercel Image Optimization costs in Next.js by tuning cache TTLs, image sizes, formats, and quality.Getting started with Image Optimization — Learn how you can leverage Vercel Image Optimization in your projects.Limits and Pricing for Image Optimization — This page outlines information on the limits that are applicable when using Image Optimization, and the costs they can iManaging Usage & Costs — Learn how to measure and manage Image Optimization usage with this guide to avoid any unexpected costs.Legacy Pricing for Image Optimization — This page outlines information on the pricing and limits for the source images-based legacy option.This page links to (19)Image Component — Optimize Images in your Next.js Application using the built-in next/image Component.next.config.js — Learn how to configure your application with next.config.js.Image — Optimize Images in your Next.js Application using the built-in next/image Component.Build Output Configuration — Learn about the Build Output Configuration file, which is used to configure the behavior of a Deployment.Vercel CDN Cache — Learn how Vercel's CDN cache stores your content across a global network to reduce latency and origin load.Purging Vercel CDN Cache — Learn how to invalidate and delete cached content on Vercel's CDN, including cache keys and manual purging options.Vercel CDN overview — Vercel's CDN is a globally distributed platform that handles routing, caching, security, and compression for every deplovercel blob — Learn how to interact with Vercel Blob storage using the vercel blob CLI command.Managing Deployments — Learn how to manage your current and previously deployed projects to Vercel through the dashboard. You can redeploy at aSystem Headers — This reference covers the list of request, response, cache-control, and custom response headers included with deploymentLimits and Pricing for Image Optimization — This page outlines information on the limits that are applicable when using Image Optimization, and the costs they can iManaging Usage & Costs — Learn how to measure and manage Image Optimization usage with this guide to avoid any unexpected costs.Getting started with Image Optimization — Learn how you can leverage Vercel Image Optimization in your projects.CDN pricing and usage — Understand CDN pricing resources, monitor usage from your dashboard, and optimize Fast Data Transfer, Fast Origin TransfManage and optimize usage — Understand how to manage and optimize your usage on Vercel, learn how to track your usage, set up alerts, and optimize yVercel Blob — Vercel Blob is a scalable, cost-effective object storage service with private and public access modes for files up to 5Vercel Blob Pricing — Learn about the pricing for Vercel Blob.@vercel/blob — Learn how to use the Vercel Blob SDK to access your blob store from your apps.Build your own web frameworkPages that link here (41)By site: nextjs (1) · vercel-changelog (2) · vercel-kb (10) · vercel-web (3) · vercel-docs (25)From nextjsImage (Legacy) — Backwards compatible Image Optimization with the Legacy Image component.From vercel-changelogNew Observability dashboard for Image OptimizationYou can now invalidate the CDN cache by providing a source imageFrom vercel-kbHow do I reduce my build time with Next.js on Vercel? — Reduce Next.js build times on Vercel by pre-rendering fewer pages at build time, deferring generation with ISR and imageHow to migrate from Fastly to Vercel with zero downtime — Consolidate your CDN infrastructure on Vercel to reduce latency, simplify your configuration, and improve your developerHow to Optimize Next.js + Sitecore JSS — This guide covers performance and usage considerations when building and deploying your Next.js and Sitecore JSS applicaMigrate a Next.js app from Webflow Cloud to Vercel — Move your Next.js app from Webflow Cloud to Vercel: remove the OpenNext Cloudflare adapter, drop the base path, map storMigrate a TanStack Start app from Netlify to Vercel — Move your TanStack Start app off Netlify and onto Vercel Functions, where Fluid compute scales it automatically. Swap toMigrate an Astro app from Webflow Cloud to Vercel — Move your Astro app from Webflow Cloud to Vercel: swap the @astrojs/cloudflare adapter for @astrojs/vercel, drop the basMigrate to Vercel from Cloudflare — Migrate your website's configuration from Cloudflare Pages or Workers to VercelVercel vs Akamai — A detailed guide to Vercel vs Akamai: compute models, AI infrastructure, framework support, media streaming, CDN capabilVercel vs Netlify — A detailed guide to Vercel vs Netlify: runtimes, compute architecture, AI infrastructure, security, and when to choose eVercel vs Render — A detailed guide to Vercel vs Render: compute models, AI infrastructure, Docker and container image support, backgroundFrom vercel-webLife of a Vercel request: Navigating the Edge NetworkThe foundations of the Frontend CloudVercel Blob is now generally available: Cost-efficient, durable storageFrom vercel-docsBuild Output Configuration — Learn about the Build Output Configuration file, which is used to configure the behavior of a Deployment.Caching — Learn how Vercel caches content across multiple layers to deliver fast responses and reduce load on your backend.Vercel CDN Cache — Learn how Vercel's CDN cache stores your content across a global network to reduce latency and origin load.Purging Vercel CDN Cache — Learn how to invalidate and delete cached content on Vercel's CDN, including cache keys and manual purging options.Vercel CDN overview — Vercel's CDN is a globally distributed platform that handles routing, caching, security, and compression for every deploFrameworks on Vercel — Vercel supports a wide range of the most popular frameworks, optimizing how your application builds and runs no matter wFrontends on Vercel — Vercel supports a wide range of the most popular frontend frameworks, optimizing how your application builds and runs noAstro on Vercel — Deploy Astro sites to Vercel and configure server-side rendering, ISR, Web Analytics, Image Optimization, and Routing MiFull-stack frameworks on Vercel — Vercel supports a wide range of the most popular backend frameworks, optimizing how your application builds and runs noNext.js on Vercel — Vercel is the native Next.js platform, designed to enhance the Next.js experience.Nuxt on Vercel — Deploy Nuxt applications to Vercel and configure rendering, functions, middleware, routing, image optimization, and cachSvelteKit on Vercel — Deploy SvelteKit applications to Vercel and configure the adapter, rendering, streaming, ISR, analytics, and Routing MidSupported Frameworks on Vercel — Learn about the frameworks that can be deployed to Vercel.Vercel CDN Compression — Vercel helps reduce data transfer and improve performance by supporting both Gzip and Brotli compressionLimits and Pricing for Image Optimization — This page outlines information on the limits that are applicable when using Image Optimization, and the costs they can iIncremental Static Regeneration \(ISR\) — ISR serves cached static pages while regenerating content in the background. Vercel\\Request Collapsing — Learn how Vercel's CDN shields your origin during traffic surges for uncached routes.CDN pricing and usage — Understand CDN pricing resources, monitor usage from your dashboard, and optimize Fast Data Transfer, Fast Origin TransfObservability Insights — List of available data sources that you can view and monitor with Observability on Vercel.Account Plans on Vercel — Learn about the different plans available on Vercel.Production checklist for launch — Ensure your application is ready for launch with this comprehensive production checklist by the Vercel engineering team.Static Configuration with vercel.json — Learn how to use vercel.json to configure and override the default behavior of Vercel from within your project.Programmatic Configuration with vercel.ts — Define your Vercel configuration in vercel.ts with @vercel/config for type-safe routing and build settings.Projects overview — A project is where you deploy and operate frontend apps, APIs, backends, containers, and agent workloads on Vercel.@vercel/blob — Learn how to use the Vercel Blob SDK to access your blob store from your apps.