Media
  1. Cloudflare ImagesYou are here
  2. Cloudflare Stream
  3. Cloudflare Realtime

Cloudflare Images

One image in, every size and format out — automatically optimized for each visitor.

What is Cloudflare Images?

Cloudflare Images is a service that stores your images and serves the perfect version of each one to every visitor — the right size, the right format, and the smallest possible file — all done automatically at Cloudflare's edge.

Edge means Cloudflare's servers spread across hundreds of cities worldwide. When someone opens your page, the image is processed and sent from a server physically close to them, so it arrives fast.

checkroom

Think of it like a tailor

You hand over one outfit (the original image). The tailor instantly resizes and re-cuts it to fit whoever walks in — phone, laptop, or huge TV — without you keeping a closet full of every size.

Why use it?

Handling images yourself is surprisingly painful: you need different sizes for phones and desktops, modern formats for speed, a place to store everything, and a fast way to deliver it. Images bundles all of that into one product.

photo_size_select_large

No more manual resizing

Stop exporting 5 sizes of every photo. Ask for any width in the URL and Images makes it on demand.

bolt

Faster pages

Smaller, modern formats (WebP/AVIF) mean less data to download and quicker load times.

warehouse

Built-in storage

Upload originals to Cloudflare and let it host them — no separate bucket or server needed.

public

Global delivery

Images ride Cloudflare's worldwide network, so visitors everywhere get them quickly.

When should you use it?

storefront

E-commerce stores

Product photos in thumbnails, grids, and zoom views — all from one upload.

newspaper

Blogs & news

Serve crisp cover images that adapt to phones and widescreens automatically.

account_circle

User uploads

Let users upload avatars or photos straight to Images with one-time direct upload URLs.

devices

Responsive sites

Any app that needs the same picture in many sizes across many devices.

How to get started

There are two ways to use Images: (1) upload originals to Cloudflare and let it host them, or (2) keep images on your own site and transform them through a special URL. Below we do both.

  1. Create an API token

    In the Cloudflare dashboard, create an API token with the Images permission. Save your Account ID too. A token is like a password that lets your code talk to Cloudflare safely.

    bash
    export CLOUDFLARE_API_TOKEN="your-token-here"
    export ACCOUNT_ID="your-account-id-here"
  2. Upload an image file

    Send the file to the Images API. The -F file=@ part attaches a local file. The response gives you an image id and ready-to-use delivery URLs (variants).

    bash
    curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/images/v1 \
      -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
      -F file=@/path/to/photo.jpg
  3. Read the response

    You get back the image id and a delivery URL. The word at the end (here 'public') is a variant — a named size/quality preset you configure in the dashboard.

    json
    {
      "result": {
        "id": "2cdc28f0-017a-49c4-9ed7-87056c83901",
        "variants": [
          "https://imagedelivery.net/abc123AccountHash/2cdc28f0-017a-49c4-9ed7-87056c83901/public"
        ]
      },
      "success": true
    }
  4. Show it on your page

    Drop the delivery URL straight into an <img> tag. That's it — Cloudflare serves the optimized image.

    html
    <img
      src="https://imagedelivery.net/abc123AccountHash/2cdc28f0-017a-49c4-9ed7-87056c83901/public"
      alt="My photo"
    />
  5. Or transform on the fly via URL

    If your image already lives on your own domain, add /cdn-cgi/image/<options>/ in front of it. Here we ask for 800px wide, 75% quality, and format=auto (Cloudflare picks WebP or AVIF if the browser supports it).

    text
    https://example.com/cdn-cgi/image/width=800,quality=75,format=auto/photo.jpg

Key concepts

tune

Variant 變體

A saved preset like 'thumbnail' (200px) or 'public' (full). You request a variant by name in the URL.

compress

Format auto 自動格式

format=auto lets Cloudflare deliver AVIF or WebP — newer, smaller formats — when the browser supports them, otherwise JPEG/PNG.

crop

Fit 縮放方式

Controls how the image fills the target box: scale-down, contain, cover, crop, or pad.

cloud

Edge / CDN 邊緣網路

CDN means Content Delivery Network — servers worldwide that cache and serve content from near each visitor.

upload_file

Direct upload 直接上傳

A one-time URL you give end users so they upload straight to Images without exposing your API token.

image

Supported formats 支援格式

Input: PNG, JPEG, GIF, WebP, SVG, AVIF, HEIC. Output: PNG, JPEG, GIF, WebP, AVIF.

Tips & pricing

savings

How billing works

Storing originals costs $5 per 100,000 images per month; delivering them costs $1 per 100,000 images per month. URL transformations give you 5,000 free unique transformations each month, then $0.50 per 1,000 after that.

straighten

Size limits to remember

Uploaded (hosted) images: up to 10 MB per file. Remote images you transform: up to 100 MB. Both cap at 100 megapixels of area and 12,000 px on any single side.

  • Use format=auto everywhere — it is the single biggest, easiest speed win.
  • Set a sensible max width; nobody needs a 6000px photo on a phone.
  • Animated GIF/WebP work too, but very large animations may skip transformation.
  • A 'unique transformation' is counted once per distinct set of options + source, then cached.