Resource: How to Host Your Images for Free with Cloudflare R2 | Stein Solutions
Setup Guides

How to Host Your Images for Free with Cloudflare R2

Get permanent image URLs that work in emails, websites, and anywhere online.

← All Resources

What this does

When you paste an image into an email or a document, it only lives on your computer. If you want that image to show up in an email newsletter, on a website, or in a social media tool, it needs a permanent web address (a URL).

Cloudflare R2 gives you a free place to store images online. You upload a file, you get a URL, and that URL works everywhere.

Think of it like your own personal image library in the cloud.

Is it really free? Yes. Cloudflare R2 is free for up to 10 GB of storage and 10 million views per month. That is way more than most small businesses will ever use. Cloudflare asks for a card on file when you activate R2, but the total is $0.00 and nothing gets charged unless you go way past the free limits.

Total time: About 10 minutes.

Step 1, Create your Cloudflare account

If you already have a Cloudflare account, skip to Step 2.

  1. Go to cloudflare.com and click Sign Up
  2. Enter your email and create a password
  3. Check your inbox and verify your email

That's it. You now have a free Cloudflare account.

Step 2, Turn on R2 storage

R2 is the part of Cloudflare that stores your files. It needs to be activated before you can use it.

Use this direct link to get there fast:

Open R2 in your Cloudflare dashboard

Can't find it manually? Log into dash.cloudflare.com, then look in the left sidebar for R2 Object Storage (it's under "Storage & databases"). Cloudflare tucks it into a spot that's easy to miss, which is why the direct link above is easier.

Once you're on the R2 page:

  1. Click the blue Add R2 subscription to my account button
  2. Add your card info and confirm
  3. The total will say $0.00

Done. R2 is now active on your account.

Step 3, Create a bucket

A "bucket" is just a folder where your images will live.

  1. You should now be on the R2 page. Click Create bucket
  2. Name it something simple like images (lowercase, no spaces)
  3. Leave the location as Automatic
  4. Click Create bucket

Tip. The name doesn't really matter. Pick something you'll remember. Most people just call it "images."

Step 4, Make it public

Your bucket starts out private, meaning nobody can see your images. You need to flip one setting so the URLs work.

  1. Click on your new bucket to open it
  2. Go to the Settings tab
  3. Scroll down to Public access
  4. Under R2.dev subdomain, click Allow Access
  5. Confirm when prompted

You'll see a public URL appear. It looks something like:

pub-abc123def456.r2.dev

That's your base URL. Every image you upload will start with this address. Save it somewhere handy.

Important. Once public access is on, anyone with the URL can see your images. Only upload images you want to be public (logos, headshots, marketing graphics). Nothing private or sensitive.

Step 5, Upload an image

  1. Make sure you're inside your bucket (click on its name if you need to go back)
  2. Click Upload files (or just drag and drop a file from your computer)
  3. Pick an image and upload it

That's it. Your image is now online.

Step 6, Copy your image URL

  1. Click on the file you just uploaded
  2. You'll see the full URL. It looks something like:

https://pub-abc123def456.r2.dev/my-logo.png

  1. Copy that URL

Now paste it anywhere you need an image:

Good to know. These URLs are permanent. Once you upload an image, the link never changes and never expires. You can use the same URL in 100 different places and it will always work.

Step 7, Get your API keys for Claude Code

This step is only needed if you want Claude Code (or another tool) to upload images for you automatically. If you're happy uploading through the dashboard, you can skip it.

Claude Code needs three pieces of info to talk to R2: your Account ID, an Access Key ID, and a Secret Access Key. Cloudflare hides these in two different spots, so follow this carefully.

Part A, Get your Account ID

  1. Open R2 in your Cloudflare dashboard
  2. Look at the right sidebar. You'll see Account ID with a copy button next to it
  3. Click the copy button. Paste it somewhere safe for now

Can't see the right sidebar? It only shows up on the R2 overview page (not inside a bucket). Click R2 Object Storage in the left sidebar to get back to the overview.

Part B, Create your Access Key

  1. Still on the R2 overview page, look at the right sidebar again
  2. Click Manage R2 API Tokens (it's a small link, easy to miss)
  3. On the new page, click the blue Create API token button
  4. Give it a name like Claude Code so you remember what it's for
  5. Under Permissions, choose Object Read & Write
  6. Under Specify bucket(s), you can either:
    • Leave it as "Apply to all buckets" (easiest)
    • Or pick just the bucket you created
  7. Leave the TTL (expiration) blank so it never expires
  8. Click Create API Token at the bottom

Part C, Save your keys NOW

Cloudflare will show you a screen with your keys. You only see the secret key once. If you close this page without copying it, you have to start over.

Copy and save these three values:

Important. Treat these keys like passwords. Anyone who has them can upload, change, or delete files in your R2 bucket. Don't paste them into emails, chats, or any document that other people can see.

Part D, Hand them to Claude Code

When Claude Code asks for your R2 credentials, give it all four:

Claude Code will save them to a file called .env on your computer, and from then on it can upload images to R2 whenever you ask.

Tips for staying organized

Tip. If you're using Claude Code, you can ask it to upload images to R2 for you automatically. Just say "upload this image to my R2 bucket" and it handles the rest.

You're building the tools. Now see where AI actually fits your business.

The free 5-minute AI Efficiency Audit scores your operations and hands you your first three moves, emailed the moment you finish. No call required.

Take the Free Audit →