Using Cloudflare Polish to compress images

Polish optimizes resources cached in the Cloudflare edge network.


Polish strips metadata and applies lossy or lossless compression. Polish accelerates image downloads by reducing image size. Learn more about Polish from our blog post.

Old URL:
Article IDs: 360000607372 | Using Cloudflare Polish to compress images

Cloudflare Image Resizing also optimizes images cached in the Cloudflare network, but is only available Business and Enterprise users.

Polish Compression Options


This option attempts to strip most metadata, e.g. EXIF data, but doesn't change the image detail. Effectively, when uncompressed, a lossless image is identical to the original.


This option attempts to strip most metadata and compresses images by approximately 15 percent. When uncompressed, some of the redundant information from the original image is lost.

Lossy has the same effect as Lossless when applied to PNG.

With Lossless and Lossy modes, Cloudflare attempts to strip as much metadata as possible. However, we cannot guarantee stripping all metadata as other factors, such as caching status, might affect which metadata is finally sent in the response.


WebP is a modern image format providing superior lossless and lossy compression for images. WebP lossless images are approximately 26 percent smaller than PNGs, while lossy images are 25 to 34 percent smaller than JPEGs.

Polish creates and caches a WebP version of the image and delivers it to the browser if the Accept header from the browser includes WebP and the compressed image is significantly smaller than the lossy or lossless compression.

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8

Currently, WebP is only supported in Firefox, Google Chrome, and Opera. You can find out more in our blog post.

Activate Polish

Images in the cache must be purged or expired before seeing any changes in Polish settings.

To activate Polish,

  1. Log in to the Cloudflare dashboard.
  2. Click the appropriate Cloudflare account for the domain where you will activate Polish.
  3. Ensure the proper domain is selected.
  4. Click on the Cloudflare Speed app.
  5. Scroll down to Polish.
  6. Select lossy or lossless from the Polish dropdown menu.
  7. (Optional) Click WebP. By applying WebP, Cloudflare can further optimize .png and .jpeg images stored in the origin server.

Verify Polish is active

Polish adds two headers to image requests that are compressed:

cf-bgj: imgq:85  

cf-polished: qual=85, origFmt=jpeg, origSize=95005  

cf-cache-status: HIT

The cf-bgj header confirms that Cloudflare applied Polish and returns the image quality setting (imgq). The cf-polished header represents the Polish status and returns the image quality setting (qual) and original size (origSize). The cf-cache-status confirms that the image has been cached and Polish can be applied.

WebP conversion does not change the image URL. The Content-Type HTTP header tells the browser the original format of an image.

Common Cf-Polished statuses

Below is a list of common Cf-Polished statuses and how to troubleshoot them. If no Cf-Polished header is returned, try using single-file cache purge to purge the image.

input_too_large: The input image is too large or complex to process and needs a lower resolution. We recommend using .png or .jpeg images that are less than 1,000px and 10MB.

not_compressed or not_needed: The image was fully optimized at the origin server and no compression was applied.

webp_bigger: Polish attempted to convert to WebP, but the image was optimized at the origin server and/or was created using a low quality setting. Because the WebP version doesn’t exist, the status is set on the JPEG/PNG version of the response.

cannot_optimize or internal_error: The input image is corrupted or incomplete at the origin server. Upload a new version of the image to the origin server.

format_not_supported: The input image format is not supported (e.g. BMP, TIFF) and/or the origin server is using additional optimization software that is not compatible with Polish. Try converting the input image to a web-compatible format (e.g. PNG, JPEG) and/or disabling additional optimization software at the origin server.

vary_header_present: The origin web server has sent a Vary header with a value other than accept-encoding. If the origin web server is attempting to support WebP, disable WebP at the origin web server and let Polish perform the WebP conversion.

Polish will still work if the accept-encoding is not the only header listed within the Vary header.

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.