Image Compression, WebP Conversion, and Per-Route Polish Settings
How edge image Polish works, which compression and WebP modes to choose, and how to scope settings with configuration rules.
This page summarizes Cloudflare documentation on Polish: automatic image optimization at the cache edge. Polish strips metadata and applies lossless or lossy compression (and optional WebP) when images are fetched from your origin, so repeat visitors get smaller, faster responses.
What Polish does and when it runs
Section titled “What Polish does and when it runs”Polish is edge-side optimization on images proxied through Cloudflare. When an image is first fetched from your origin, Cloudflare optimizes it in cache; later requests for the same URL receive the optimized version.
Cloudflare Polish is a one-click image optimization product that automatically optimizes images in your site. Polish strips metadata from images and reduces image size through lossy or lossless compression to accelerate the speed of image downloads.
— Cloudflare, Cloudflare Polish
Polish is disabled when the origin sends Cache-Control: no-transform, per Origin Cache Control.
Polish compression modes: Off, Lossless, Lossy, and WebP
Section titled “Polish compression modes: Off, Lossless, Lossy, and WebP”Dashboard and API modes match the Configuration Rules polish setting: off, lossless, lossy, and webp.
| Mode | What it does | Typical trade-off |
|---|---|---|
| Off | No compression applied | Cached polished copies stay until purge or expiry (compression docs) |
| Lossless | Same pixels; metadata stripped; ~21% smaller on average | No JPEG→WebP conversion (lossy) |
| Lossy | Stronger compression; ~48% smaller on average | Small visible quality loss on some images |
| WebP | Lossy/lossless plus WebP when beneficial | Served only when Accept includes WebP and WebP is clearly smaller |
The Lossless option prevents conversion of JPEG to WebP, because this is always a lossy operation.
— Cloudflare, Polish compression
With WebP enabled (dashboard optional checkbox or polish: "webp" in rules), Polish may serve WebP when the browser advertises support—for example:
Accept: image/avif,image/webp,image/*,*/*;q=0.8
Polish optimizes standard formats at the origin; it does not re-optimize origin responses that are already WebP (Polish compression — WebP).
Why WebP is sometimes skipped
Section titled “Why WebP is sometimes skipped”Polish avoids WebP when conversion would increase file size or hurt quality more than it saves bytes (WebP may be skipped):
- Lossless zone setting: JPEG is not converted to WebP-VP8 without quality loss; PNG/GIF may still use WebP-lossless paths.
- Low-quality JPEG at origin (around q=60 or below): blockiness can make WebP larger than the JPEG.
- Fine detail and saturated edges: VP8 can look smeared; a well-optimized JPEG may stay.
- Double lossy compression: CMS or origin optimizers plus Polish multiply quality loss; disable origin WebP/converters when using Polish (activate Polish, compression — file size and WebP).
Cloudflare will not convert from JPEG to WebP when the conversion would make the file bigger, or would reduce image quality by more than it would save in file size.
— Cloudflare, Polish compression
For better WebP uptake, Cloudflare recommends Lossy Polish and high-quality JPEG at origin (often quality 80–90, not above 95) so Polish has room to compress (WebP may be skipped, compression).
Vary headers and metadata
Section titled “Vary headers and metadata”Polish may not be applied to origin responses that contain a Vary header. The only accepted Vary header is Vary: Accept-Encoding.
— Cloudflare, Polish compression
A vary_header_present status means the origin sent Vary with a value other than accept-encoding; disable origin WebP and let Polish handle WebP (Cf-Polished statuses).
Activate Polish: dashboard steps and cache purge
Section titled “Activate Polish: dashboard steps and cache purge”After you change Polish, purge or wait for cache expiry on affected images before judging results.
Images in the cache must be purged or expired before seeing any changes in Polish settings.
— Cloudflare, Activate Polish
- In the Cloudflare dashboard, open Account home, then select the zone (Activate Polish).
- Go to Speed > Settings > Image Optimization.
- Under Polish, choose Lossy or Lossless (Lossy saves more bytes).
- Optionally enable WebP for PNG/JPEG from origin when the client supports WebP.
- If you use origin WebP utilities, disable them so cached responses are not sent as WebP to clients without WebP support (Activate Polish).
Configuration Rules: Polish and WebP per route or hostname
Section titled “Configuration Rules: Polish and WebP per route or hostname”Zone-wide Polish is not always what you want. Configuration Rules override settings for matching requests (path, hostname, headers, country, and similar). The zone must be proxied through Cloudflare.
You can now enable Polish with the webp format directly in Configuration Rules, allowing you to optimize image delivery for specific routes, user agents, or A/B tests — without applying changes zone-wide.
— Cloudflare, Fine-tune image optimization — WebP now supported in Configuration Rules
API property polish accepts "off", "lossless", "lossy", or "webp" (Configuration Rules settings — Polish):
"action_parameters": { "polish": "webp"}Use a configuration rule when Polish should apply only on specific hostnames instead of the whole zone.
Cf-Polished response header: status values and fixes
Section titled “Cf-Polished response header: status values and fixes”Responses that Polish touches can include a Cf-Polished header describing the outcome. If it is missing, try a single-file cache purge, or check that Content-Type is an image and Cache-Control allows caching (Cf-Polished statuses).
| Status | Meaning | What to try |
|---|---|---|
input_too_large |
Over limits (guidance: under 4,000 px per side and under 20 MB) | Resize at origin; use PNG or JPEG |
not_compressed / not_needed |
Already optimal at origin | Expected; no further compression |
webp_bigger |
WebP would not beat original | See WebP may be skipped |
cannot_optimize / internal_error |
Corrupt or incomplete file | Re-upload at origin |
format_not_supported |
e.g. BMP/TIFF, or conflicting origin optimizer | Convert to PNG/JPEG; disable conflicting software |
vary_header_present |
Non–accept-encoding Vary |
Fix origin Vary; turn off origin WebP |
Polish skips image URLs processed by Cloudflare Images.
— Cloudflare, Cf-Polished statuses
For broader image issues, see Image optimization troubleshooting (Polish statuses, missing images, optimization on already-optimized files).
Common mistakes
Section titled “Common mistakes”- Enabling Polish and image transformations together (Activate Polish).
- Expecting instant changes without purging cached images (Activate Polish).
- Lossless Polish but expecting broad JPEG→WebP (Polish compression).
- Origin
no-transformblocking Polish (Origin Cache Control). Varyheaders beyondAccept-Encoding(Polish compression, Cf-Polished statuses).- Low-quality JPEG plus WebP (WebP may be skipped).
How to check this on your site
Section titled “How to check this on your site”- Confirm Polish under Speed > Settings > Image Optimization matches the mode you expect (Activate Polish).
- Purge one test image URL, then request it with and without
Accept: image/webpand compare size and format. - Inspect response headers for
Cf-Polishedand map the value using Cf-Polished statuses. - If polish settings differ by path or hostname, verify matching Configuration Rules and the
polishvalue in settings. - You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page looks wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact wording you are asking about.