Use transformation URLs to optimize images from any origin. Optimization parameters tell Images how to process an image, such as setting its quality, format, and size, and other options.
By default, transformation URLs use the following structure:
https://<ZONE>/cdn-cgi/image/<OPTIONS>/<SOURCE-IMAGE>Before Images can process transformation URLs, you must enable the URL interface for each zone or Worker that serves them.
Choose a configuration scope based on where you serve transformation URLs:
| Scope | Use case | Behavior |
|---|---|---|
| Zone | Serve transformation URLs from your Cloudflare zone. | Applies across the zone, including custom domains routed to a Worker. |
| Worker | Serve transformation URLs from your workers.dev subdomain or test them on a local Worker development server. |
Applies to that Worker and overrides the zone configuration for custom domains connected to it. |
For custom domains routed to a Worker, Worker-scoped configuration, when present, always overrides zone-scoped configuration for requests handled by that Worker.
By default, transformation URLs accept source images from the same zone. You can set up an allowlist to configure allowed origins. Refer to Define source origins for defaults, limits, wildcard behavior, and examples.
Enable the URL interface on a Cloudflare zone through the Cloudflare CLI, dashboard, or REST API.
Replace example.com with your zone, then turn on the URL interface with:
cf zones settings edit transformations \
--zone example.com \
--body '{"value":"on"}'If your source images are outside this zone, then replace images.example.net with the allowed origin:
cf zones transformations-allowed-origins edit \
--zone example.com \
--value "images.example.net"-
Go to Images > Transformations.
Go to Transformations ↗ -
Select the zone where you want to serve transformation URLs.
-
Turn on Transformations.
-
Optionally, configure allowed origins under Sources.
Send a PATCH request to /zones/{zone_id}/settings/transformations with "value": "on". Refer to the Edit zone setting API.
You can optionally configure allowed origins with transformations_allowed_origins.
Enable the URL interface on a workers.dev subdomain through Wrangler, the Cloudflare CLI, or REST API.
Worker-scoped settings also apply through Worker routes that match the transformation request. Transformation URLs use /cdn-cgi/image/*, so a route such as example.com/* matches, but example.com/foo/* does not.
Deployed transformation settings remain active until you explicitly change them. To disable transformation URLs, set enabled to false through your configuration or the REST API.
Turn on the URL interface in your Wrangler configuration file or in cloudflare.config.ts for the Cloudflare CLI. The following configuration enables transformation URLs with sources from the same zone:
import { defineConfig } from "cf/config";
export default defineConfig({
worker: {
name: "image-app",
// Set this to today's date
compatibilityDate: "2026-11-25",
images: {
urlTransformations: {
enabled: true,
},
},
},
});{
"$schema": "./node_modules/wrangler/config-schema.json",
"images": {
"url_transformations": {
"enabled": true
}
}
}[images.url_transformations]
enabled = trueIf your source images are outside the Worker's zone, then set an explicit allowlist with allowed_origins in Wrangler or allowedOrigins in cloudflare.config.ts:
import { defineConfig } from "cf/config";
export default defineConfig({
worker: {
name: "image-app",
// Set this to today's date
compatibilityDate: "2026-11-25",
images: {
urlTransformations: {
enabled: true,
allowedOrigins: [
"images.example.com",
"image-app.<YOUR_SUBDOMAIN>.workers.dev",
],
},
},
},
});{
"$schema": "./node_modules/wrangler/config-schema.json",
"images": {
"url_transformations": {
"enabled": true,
"allowed_origins": [
"images.example.com",
"image-app.<YOUR_SUBDOMAIN>.workers.dev"
]
}
}
}[images.url_transformations]
enabled = true
allowed_origins = [
"images.example.com",
"image-app.<YOUR_SUBDOMAIN>.workers.dev",
]Run wrangler deploy or cf deploy to apply them to the deployed Worker. For local development, run wrangler dev or cf dev.
Named Wrangler environments do not inherit images.url_transformations.
Version URLs support the URL interface using the Worker's deployed settings, rather than version-specific settings. wrangler versions upload does not update images.url_transformations.
You can use the URL interface in local development through Wrangler, the command-line interface for Workers. Usage in local development does not incur billable usage.
Set images.url_transformations.enabled to true to enable URLs locally.
In local development, transformation URLs always accept relative sources; any allowed origins are additional.
Local transformations use a low-fidelity offline version that supports a limited subset of features such as resizing, rotation, and format conversion. Deploy your Worker to test complete production behavior.
Send a PUT request to /accounts/{account_id}/settings/transformations/workers/{script_name}.
You can optionally configure allowed origins with allowed_origins.
When Cloudflare receives a transformation request, it checks for a cached result for the same source image and optimization parameters:
- On a cache HIT — Cloudflare serves the optimized image directly from the edge without contacting the origin or re-applying the optimization parameters.
- On a cache MISS — Cloudflare fetches the source image, applies the requested optimizations, caches the transformed result, then returns it to the browser. Cloudflare also caches the original image so future transformations can use it without another origin request.
After enabling transformations on your zone or Worker, you can configure how Cloudflare handles transformation requests:
- Define source origins — Configure origins where Cloudflare can fetch source images.
- Create transformation flows — Set up automated rules that apply image optimization to matching requests without requiring URL changes or custom code.
- Control origin access — Use Workers to add custom logic for validating and controlling access to source images.
- Set up rewrite rules — Use Transform Rules to rewrite image URLs and serve transformations from custom paths.