October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Optimize Images on Netlify with Image CDN

Use Netlify Image CDN to resize, crop, and format images on demand, with instructions for local and remote sources, framework integrations, and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Netlify Image CDN to resize and crop images as they are requested, then serve a suitable format and quality for each use. For images stored with your site, start with a relative source URL; for remote images, first allowlist the source domain. If your project uses a supported framework, its image component may be the simpler integration.

How do I optimize images on Netlify?

Netlify Image CDN transforms images on demand through /.netlify/images. It can resize and crop images, convert formats, negotiate an output format from the browser’s Accept header, and cache transformed results. Netlify Docs says these transformations do not affect build times.

As an Amazon Associate I earn from qualifying purchases.

For a same-site image, put its path in the url parameter and add only the dimensions and behavior you need:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
/.netlify/images?url=/images/photo.jpg&w=800

Relative source paths need no additional configuration. Match the output dimensions to the image’s rendered use rather than serving a needlessly large original. For repeated uses at different sizes, request the dimensions appropriate to each context.

How do I resize or crop an image with Netlify Image CDN?

Set dimensions and fit behavior

The w and h parameters accept integer pixel dimensions. You can set one or both. The default fit is contain, which preserves the image’s proportions. Use cover to fill the requested dimensions by cropping; position controls which region remains visible. Use fill only when stretching the image to the exact dimensions is acceptable.

/.netlify/images?url=/images/photo.jpg&w=600&h=400&fit=cover&position=center

For a card image, inspect the result at its actual display size and choose a position that keeps the important subject in frame. Cropping can remove content near the edges; fill can distort it.

Choose an output format and quality

Use fm to force an output format: avif, jpg, png, webp, gif, or blurhash. Without fm, Netlify checks browser support in this order: WebP, then AVIF, then the original format. A request that only specifies a source can therefore still receive a modern format when the browser accepts it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

The q parameter sets lossy conversion quality as a whole number from 1 to 100. Netlify documents a default of 75 for supported lossy conversions. This example shows the syntax, not a universally best setting:

/.netlify/images?url=/images/photo.jpg&w=800&fm=avif&q=75

Compare the result visually with the original, especially for text, fine edges, gradients, and photographs. The appropriate format and quality depend on the image and its use; Netlify’s documentation does not prescribe one best value for every image.

Does Netlify automatically convert images to WebP or AVIF?

Netlify negotiates the output format based on the browser’s Accept header when you do not set fm. Its documented preference order is WebP, then AVIF, then the source format. Set fm when you need to request a particular supported format rather than rely on negotiation.

Forcing a format is a choice, not a guarantee that it is best for every asset. Check the rendered output in the contexts and browsers you support.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I use remote images with Netlify Image CDN?

Remote sources must be permitted in your site’s netlify.toml under images.remote_images. Keep the pattern as narrow as your actual image sources allow. For example:

[images]
  remote_images = ['https://images.example.com/.*']

Then provide the complete remote image URL as the url parameter. Follow Netlify’s current TOML escaping guidance when a regular expression needs escaping; a single-quoted literal string or correctly escaped backslashes can avoid ambiguity.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
  • The remote image must be publicly accessible, or use a self-authorizing URL such as a presigned URL.
  • Netlify does not forward credential-bearing Authorization or Cookie headers to remote sources.
  • If the request fails for a remote source, check the allowlist pattern and whether the source can be fetched without those credentials.

Should I use a direct URL or a framework image component?

Use a direct /.netlify/images URL when you want to control transformation parameters explicitly or are working outside the documented framework integrations. If your framework is supported, its standard image component can wire requests into Image CDN, subject to the relevant version and configuration prerequisites.

Framework Documented integration and configuration
Angular NgOptimizedImage automatically uses Image CDN. Configure remote domains with images.remote_images.
Astro <Image /> automatically uses Image CDN. Configure remote images in astro.config.mjs with image.domains or image.remotePatterns.
Gatsby Set NETLIFY_IMAGE_CDN=true and use supported Contentful, Drupal, or WordPress source plugins. Netlify’s documentation distinguishes requirements by Gatsby version.
Next.js The documented route requires Next.js 13.5 or later and Netlify adapter v5. Configure remote paths with remotePatterns in next.config.js.
Nuxt nuxt/image automatically uses Image CDN. Configure remote domains in image.domains in nuxt.config.ts.

Framework prerequisites and configuration can change. Verify the current Netlify documentation for your framework and version before relying on automatic integration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do caching and local testing work?

Netlify uniquely caches transformed output at the edge, so repeated requests for the same transformation can use the cached result. Image CDN respects atomic deploys by default: when a relative source image changes in a new deploy, new requests trigger transformations against the new source.

Use Netlify Dev to test transformations locally in an environment intended to mimic production. Check representative images and transformation parameters before deploying broadly.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What limitations should I know about?

  • Image CDN is not supported with Split Testing; Netlify warns it may produce inconsistent results between branches.
  • Netlify says Image CDN is not currently part of its HIPAA-compliant hosting offering.
  • Cross-site redirects for image transformations are discouraged because they may negatively affect performance.
  • Do not confuse the current /.netlify/images route and its url, w, h, and fit parameters with legacy Large Media syntax such as nf_resize=fit or nf_resize=smartcrop. Existing Large Media setups are a separate workflow.

Troubleshooting Netlify Image CDN

The transformed image does not load

  • For a local asset, check that the path in url matches the deployed file path.
  • For a remote asset, verify that its URL matches an images.remote_images pattern and that the image is publicly accessible or self-authorizing.
  • Do not expect Netlify to pass through remote-source authorization or cookie headers.

The result has the wrong dimensions or crop

  • Check that w and h are integer pixel values.
  • Confirm the fit mode: contain preserves proportions, cover crops to fill, and fill may distort.
  • With cover, adjust position to retain the image region you need.

The output format is unexpected

If fm is omitted, the browser’s Accept header affects negotiation. Specify a supported value with fm when you need to force the format, and inspect lossy output at the chosen q value.

Framework images are not using Image CDN

Check that the framework and adapter versions meet the documented prerequisite, and that remote-image settings are in the framework’s expected configuration file. Gatsby additionally requires NETLIFY_IMAGE_CDN=true and one of the supported source plugins.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or skip the browser setup

If your task is capturing a web page as an image or PDF rather than optimizing image assets served by Netlify, ScreenshotNeo is a separate website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF. For example, using cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. Cookie banners, popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for free.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.