Programming

Cloudflare Workers Can Now Resize Images on workers.dev — No Custom Domain Required

Cloudflare's URL-based image transformations no longer require a custom domain. A Worker can now resize and optimize images through its workers.dev address, with origin restrictions and caching handled by Cloudflare.

You deploy a Cloudflare Worker and receive a working address:

https://image-app.<YOUR_SUBDOMAIN>.workers.dev

The Worker can serve requests, return images, and communicate with external services. But suppose you want to resize an image directly through a URL.

On a custom domain configured for Cloudflare Images, the familiar approach is:

/cdn-cgi/image/width=400,format=auto/photo.jpg

Until recently, that URL interface was not available directly on workers.dev.

Developers could still optimize images through a Worker’s fetch() requests using cf.image, or use an Images binding for other workflows. But they could not simply enable the standard transformation URL format on the default Worker subdomain.

On November 25, 2026, Cloudflare announced that this restriction had changed.

Workers now supports URL-based image transformations on workers.dev through a new Worker-scoped configuration.

The feature also works during local development with Wrangler, although local processing has limitations that are worth understanding before relying on its output.

What actually changed?

Cloudflare Images can resize and optimize images when a request contains transformation parameters.

For example:

https://image-app.<YOUR_SUBDOMAIN>.workers.dev/cdn-cgi/image/format=auto,width=400/image.png

The URL contains three relevant parts.

/cdn-cgi/image/ identifies the image transformation interface.

format=auto,width=400 specifies the requested operations.

/image.png identifies the source image, which must already be accessible from the Worker’s hostname.

Cloudflare retrieves the original image, applies the transformation, and returns the processed result.

The example requests an image with a width of 400 pixels and asks Cloudflare to select an appropriate output format based on the client’s capabilities.

It does not require a custom domain.

But this is not a new image-processing engine. Cloudflare is extending access to an existing interface.

Previously, developers could perform similar work inside a Worker:

const response = await fetch(imageUrl, {
  cf: {
    image: {
      width: 400,
      format: "auto"
    }
  }
});

That approach remains useful when application code needs to determine transformation options dynamically.

The new URL interface is simpler when the required operation can be expressed directly in the URL.

Instead of writing a Worker handler specifically to resize each image, the transformation parameters become part of the request itself.

Enable image transformations in Wrangler

The new configuration is relatively small.

If the project uses wrangler.toml, add:

[images.url_transformations]
enabled = true

For a project using wrangler.jsonc, the equivalent is:

{
  "images": {
    "url_transformations": {
      "enabled": true
    }
  }
}

These are configuration fragments. Preserve the project’s existing name, entry point, compatibility date, and other settings when adding them.

After enabling transformations, deploy the Worker:

npx wrangler deploy

Cloudflare applies the setting to the deployed Worker.

Assuming that the Worker already serves a valid image at /image.png, the corresponding optimized URL can be requested:

https://image-app.<YOUR_SUBDOMAIN>.workers.dev/cdn-cgi/image/width=400,format=auto/image.png

Replace the hostname with your actual Worker address.

The original image must exist. Enabling transformations does not automatically create an image server or upload images.

If the Worker returns HTML, JSON, or a missing-file response at /image.png, Cloudflare will not be able to transform that response into the expected image.

This is an important distinction between enabling the image URL interface and supplying images for it to process.

Transform images from another domain

Perhaps the original images are not hosted by the Worker.

They might be stored in a separate image CDN or another publicly accessible origin.

Cloudflare supports external image sources, but the Worker must explicitly allow them.

For example:

{
  "images": {
    "url_transformations": {
      "enabled": true,
      "allowed_origins": [
        "images.example.com",
        "image-app.<YOUR_SUBDOMAIN>.workers.dev"
      ]
    }
  }
}

Here, images.example.com is a placeholder for the actual source hostname.

The second entry represents the Worker’s own hostname.

Cloudflare’s configuration guidance recommends explicitly including the Worker hostname when defining an origin allowlist and using relative or same-host source images.

With a valid image hosted on the permitted external domain, the transformation URL can follow this structure:

https://image-app.<YOUR_SUBDOMAIN>.workers.dev/cdn-cgi/image/width=400,format=auto/https://images.example.com/photo.jpg

Cloudflare retrieves the image from the permitted source and applies the requested optimization.

If the hostname is not allowed, the request can be rejected.

For Worker-scoped configuration, Cloudflare currently permits up to 10 explicitly configured origin hostnames.

This restriction matters because image transformations consume resources.

Allowing arbitrary third-party image URLs could let others use your Worker hostname to request transformations you did not intend to provide.

A restricted allowlist gives the application more control over where its source images originate.

There is also a subtle security limitation: Cloudflare checks the initial source URL against the allowed origins. Redirects may lead to other destinations.

Therefore, an origin allowlist is not an absolute guarantee about every destination involved in retrieving an image.

For applications with stricter requirements, additional source validation may still be necessary.

What happens in local development?

The November update also introduces support for the URL interface during local Worker development.

Start the Worker:

npx wrangler dev

With the configuration enabled, transformation URLs can be requested through the local development server.

For example, assuming the original image is available at /image.png:

http://localhost:8787/cdn-cgi/image/width=400/image.png

The precise local port depends on the Wrangler configuration.

This is useful for testing URL construction and application integration without deploying every change.

However, local and production transformations are not identical.

Cloudflare describes local image processing as a low-fidelity offline implementation.

It supports a limited selection of operations, including resizing, rotation, and format conversion.

Other transformation parameters may not behave as they do in production.

So a successful local test establishes that the URL structure and basic operation work, but it does not guarantee identical image output after deployment.

Cloudflare recommends testing the complete transformation behavior on the deployed Worker.

Local transformation usage is not billed.

Does it require an Images binding?

No.

Cloudflare explicitly states that URL-based transformations do not require an IMAGES binding.

The two approaches have different purposes.

An Images binding gives Worker code access to image-processing functionality, including workflows that operate directly on image data.

The /cdn-cgi/image/ interface accepts transformation options through URLs.

For a website that only needs differently sized images, the URL interface can be simpler.

For example, responsive images might be requested through URLs with different widths:

/cdn-cgi/image/width=320,format=auto/photo.jpg
/cdn-cgi/image/width=640,format=auto/photo.jpg
/cdn-cgi/image/width=960,format=auto/photo.jpg

Each URL requests a particular size from the same original image.

There is no need to store three separate copies manually merely to provide these variants.

However, each distinct transformation can count toward Cloudflare Images usage.

The lack of a binding requirement should not be confused with unlimited free processing.

How caching works

Cloudflare automatically caches transformed images in production.

When an image transformation request arrives, Cloudflare checks whether the result is already available.

If the transformed image is cached, Cloudflare can serve it without fetching and processing the original again.

If it is not cached, Cloudflare retrieves the original image, applies the transformation, and stores the result.

This matters when the same image is requested repeatedly.

A website might display the same 400-pixel image hundreds of times across different visits.

The image does not need to be transformed from scratch on every request.

Cloudflare also documents caching of the original image so later transformations may not require another origin fetch.

Still, changing the transformation parameters can produce a different cached variant.

For example:

width=400
width=800

These represent different requested dimensions.

They can therefore count as separate unique transformations.

Is it free?

Cloudflare Images has a free allowance for image transformations.

According to its pricing documentation, the Free plan includes 5,000 unique transformations per month.

A unique transformation is determined by the source image and relevant transformation parameters.

Repeated requests for the same transformation within the same calendar month do not count as additional unique transformations.

Cloudflare also excludes changes to format and quality from its unique-transformation count.

On the Free plan, exceeding the allowance does not automatically create a bill.

Instead, new transformations return error 9422, while previously cached transformations can continue to be served.

For the Paid plan, the documented pricing is:

Usage Price
First 5,000 unique transformations/month Included
Additional unique transformations $0.50 per 1,000
Repeated requests for the same transformation Not counted again as unique transformations

These figures concern image transformations. Other Cloudflare services used by an application may have separate pricing.

For a small site with a limited image library, the included allowance may be sufficient.

But applications that accept arbitrary widths or transformation combinations can generate many distinct variants.

Restricting available sizes to a reasonable set can make both caching and usage easier to manage.

What if the setting disappears from Wrangler?

One final configuration detail is easy to miss.

Cloudflare says deployed image transformation settings remain active even if you remove the configuration section from the project.

Removing:

[images.url_transformations]
enabled = true

is therefore not the documented way to disable the feature.

Instead, explicitly deploy:

[images.url_transformations]
enabled = false

There is another consideration for projects using named Wrangler environments.

Those environments do not automatically inherit the images.url_transformations configuration.

If a project uses separate staging and production environments, configure the setting for each relevant environment rather than assuming the base configuration applies everywhere.

This can explain why the transformation URL works in one deployment but fails in another.

The Worker may be running correctly in both environments while the URL interface is enabled in only one.

What changed on November 25?

Cloudflare already supported resizing images from Workers before this release.

The November 25 update removes a specific deployment restriction: the standard /cdn-cgi/image/ URL interface can now work directly on workers.dev through Worker-scoped configuration.

Developers no longer need to connect a custom domain just to use that URL format.

The same configuration also enables local testing through Wrangler, although local image processing does not reproduce every production feature.

External source images still require appropriate origin configuration, and image transformations remain subject to Cloudflare Images usage limits.

The practical benefit is less setup for relatively simple image optimization.

A small application can deploy a Worker, enable the URL interface, and request differently sized images through ordinary URLs.

There is no need to introduce a custom domain solely for this feature or maintain separate Worker code for every basic resize operation.

The rest of the responsibility remains familiar: the original images must be accessible, allowed origins should be configured carefully, and the application should avoid creating unnecessary transformation variants.

External Sources used for this article

Related Articles

View all →