Netlify Image CDN
Transform images by requesting the endpoint with a url query parameter. This is the current and only documented surface — there is no legacy form.
url is required; all other parameters are optional.
Query parameters
Common transformations
fit behavior
contain(default): maintains aspect ratio; one dimension may come back smaller than requested. Supply one dimension and the other is computed.cover: fills exactly, cropping excess. Requires BOTHwandh— omitting either is invalid. Usepositionto choose what's retained.fill: fills exactly, stretching/squishing if aspect ratios differ.
Format notes
qapplies only when output isavif,jpg,gif, orwebp.webpandgifcan be static or animated.- If
fmis omitted, format is content-negotiated from theAcceptheader:webpif accepted, elseavifif accepted, else the original format. A source-only request (no other params) still converts towebp/avifbut keeps size and shape.
Remote source images
Remote sources must be allowlisted in netlify.toml before transformation, or the request fails.
Percent-encode remote source URLs before placing them in the url parameter with encodeURIComponent — a URL containing ? or & breaks otherwise.
Constraints:
- Remote sources must be publicly accessible.
- Credential-bearing headers (
Authorization,Cookie) are NOT forwarded when fetching a remote source. For authenticated sources, use URLs that carry their own authorization (e.g. S3 presigned URLs) and make sure yourremote_imagespatterns match those full URLs.
remote_images regex escaping
The only meaningful escape is the literal dot (\.). Forward slashes are NOT metacharacters — never write https:\/\/. In netlify.toml, use single-quoted literal strings ('https://example\.com/.*') or double the backslash in double-quoted strings ("https://example\\.com/.*"). A bare \. inside double quotes is invalid TOML.
Response codes
- Invalid transformation parameter values →
404. - Valid new transformation →
200with content and matchingcontent-type. - Previously transformed (cached) image →
304.
Reusing parameters across images
Map a friendly path to the endpoint with a redirect/rewrite.
_redirects:
netlify.toml:
Then GET /transform-small/owl.jpeg returns the transformed image. Cross-site redirects for transformations are NOT recommended — they can degrade site performance.
Caching headers
Apply custom headers to source images on the site's own domain; they carry through to the transformed output.
netlify.toml:
- Custom headers can be applied to source images on the site's domain only — NOT to remote source images (Netlify does respect cache headers the external domain sends).
Cache-Controlon source images applies only to browsers and CDNs in front of Netlify, NOT the Netlify Cache itself.
Blur placeholders (fm=blurhash)
fm=blurhash returns a BlurHash text string, not image bytes. Pointing an <img src> (or CSS background) at it renders nothing. Fetch the string ahead of time, decode it client-side with a BlurHash library (https://blurha.sh), and load the real image as a separate request without fm=blurhash.
Local development
The /.netlify/images endpoint, [images] allowlisting, and image redirects only exist under netlify dev (Netlify CLI). A local 404 on /.netlify/images almost always means a framework dev server (vite, next dev, astro dev) is running instead of netlify dev — the URL itself is usually fine. Start the local environment with netlify dev.
User-uploaded image pipelines
For pipelines composing Functions + Blobs + Image CDN (handling user-uploaded images), see references/user-uploads.md.
Framework image handling
Many frameworks route their built-in image optimization through Netlify Image CDN — use the framework's standard image component/syntax and only configure the remote allowlist. For unlisted frameworks, call /.netlify/images directly.
Setup guides: Angular, Astro, Gatsby, Next.js, Nuxt.
Additional constraints
- Deploy behavior: transforms respect atomic deploys; changing a source image in a new deploy re-runs transforms on subsequent requests.
- Split Testing is NOT supported — image results may be inconsistent across split test branches.
- Netlify Image CDN is NOT part of Netlify's HIPAA-compliant hosting offering.
Interactive parameter playground: https://image-cdn-playground.netlify.app/
<!-- system: agent-context/image-cdn/system.md — human-owned, merged by ctx-gen; edit system.md, not this section -->Netlify house rules (image-cdn)
These are org conventions, not docs facts — merged into the rendered skill by ctx-gen and never generated. Owned by the skills maintainer.
- For user-uploaded image pipelines (Functions + Blobs + Image CDN
composed), see
references/user-uploads.mdin this skill — an authored guide with no single docs source. - Percent-encode remote source URLs before placing them in the
urlparameter (encodeURIComponent) — URLs containing?or&break otherwise. fm=blurhashreturns a BlurHash TEXT string, not image bytes. Pointing an<img src>(or CSS background) at it renders nothing — fetch the string ahead of time, decode it client-side with a BlurHash library, and load the real image as a separate request withoutfm=blurhash.- A local 404 on
/.netlify/imagesalmost always means a framework dev server (vite,next dev,astro dev) is running instead ofnetlify dev— the endpoint,[images]allowlisting, and image redirects only exist undernetlify dev. The URL itself is usually fine. - In
remote_imagespatterns, the meaningful regex escape is the dot; forward slashes are not metacharacters — do not writehttps:\/\/. Innetlify.toml, use a single-quoted literal string ('https://example\.com/.*') or double the backslash in a double-quoted string ("https://example\\.com/.*") — a bare\.inside double quotes is invalid TOML.


