Cloudflare R2 vs Backblaze B2 for Developers: Egress Costs and S3 Compatibility Tested

May 22, 2026 2 min read 61 views

You're building something that stores and serves files β€” images, backups, user uploads, build artifacts β€” and your AWS S3 bill just reminded you that egress fees are not a rounding error. Cloudflare R2 and Backblaze B2 are the two names that keep coming up as alternatives. Both claim S3 compatibility and both make a big deal about egress pricing. But the details matter when you're writing the code that has to actually talk to these services.

This article puts both services through their paces from a developer's perspective: how the pricing really works, how complete the S3 API compatibility actually is, and which service fits which kind of project.

What you'll learn

  • How Cloudflare R2 and Backblaze B2 price egress differently β€” and what that means at scale
  • Where each service's S3 API compatibility breaks down in practice
  • How to connect to both using the AWS SDK with minimal code changes
  • Which service is the better fit for static assets, backups, and application storage
  • Common gotchas that will cost you time if you hit them in production

Prerequisites

This article assumes you're comfortable with object storage concepts (buckets, keys, presigned URLs) and have used at least one S3-compatible API before. Code examples use Python with boto3. The same patterns apply in any language with an AWS SDK.

The Egress Pricing Difference

This is the headline claim for both services, so let's be precise about what each one actually offers.

Cloudflare R2 charges zero egress fees when data leaves through Cloudflare's network β€” including direct API downloads and any traffic routed through a Cloudflare Worker or a connected custom domain with Cloudflare proxying. The free tier covers a generous monthly amount of storage and operations before any costs kick in. You pay for storage by the gigabyte-month and for Class A operations (writes, lists) and Class B operations (reads) above the free tier thresholds.

Backblaze B2 has its own free egress arrangement, but the conditions are narrower. Downloads are free when the traffic goes through Backblaze's partner CDN network, which includes Cloudflare (via their Bandwidth Alliance), Fastly, and a handful of others. If you pull data directly from B2 via the API without one of those CDN partners in the path, you pay per gigabyte. The free tier for storage is also generous for a first slice of data.

The practical consequence: if your architecture already runs behind Cloudflare, both services can give you free egress. If you're using a CDN outside the B2 partner network and downloading large files, B2's egress charges add up. R2's zero-egress policy is unconditional; B2's depends on your CDN choice.

S3 API Compatibility: What Works and What Doesn't

Both services advertise S3 compatibility, which means you can point your existing boto3 or aws-sdk code at a different endpoint and β€” mostly β€” things just work. The

πŸ“€ Share this article

Sign in to save

Comments (0)

No comments yet. Be the first!

Leave a Comment

Sign in to comment with your profile.

πŸ“¬ Weekly Newsletter

Stay ahead of the curve

Get the best programming tutorials, data analytics tips, and tool reviews delivered to your inbox every week.

No spam. Unsubscribe anytime.