Cloudflare R2

Also known as: R2

On this page 7

Cloudflare R2 is an S3-compatible object storage service operated by Cloudflare that stores unstructured data in buckets and, unlike most providers, charges no egress fees for reading data out to the internet. In cloud storage, R2 occupies the same role as Amazon S3, Azure Blob Storage or Google Cloud Storage, but its pricing model and its tight integration with an edge network change the economics of serving large or frequently downloaded files.

Teams usually adopt R2 for bandwidth-heavy workloads: media libraries, software downloads, machine learning datasets, backups that are restored often and static assets for websites. The service exposes the familiar S3 API, so most existing tools and SDKs work after a change of endpoint and credentials.

How Cloudflare R2 stores and serves objects

R2 follows the standard object storage model: data lives as immutable objects identified by a key inside a storage bucket, with metadata stored alongside each object. There is no file system hierarchy; prefixes in keys only simulate folders, and listing operations filter by prefix.

When a bucket is created, R2 places it in a region chosen automatically from the location of the first request, or in a region selected through a location hint. Objects are written with strong read-after-write consistency, so a successful upload is immediately visible to subsequent reads and listings. Cloudflare states a design target of eleven nines of annual durability, achieved by storing multiple copies of each object across separate failure domains.

Access happens through three main paths. Applications call the S3-compatible endpoint with access keys; code running on Cloudflare Workers reaches the bucket through a native binding without network credentials; and public content can be exposed through a custom domain that sits behind the Cloudflare cache. The following table summarizes these access paths.

Access pathAuthenticationTypical use
S3-compatible APIAccess key and secret, Signature Version 4Existing tools, backups, data pipelines
Workers bindingImplicit, granted by configurationEdge applications, image processing, APIs
Custom domainPublic or protected by access rulesWebsites, downloads, media delivery
Presigned URLTime-limited signature in the URLDirect browser uploads and private downloads
r2.dev subdomainPublic, rate limitedDevelopment and testing only
Ways to access data in R2

The R2 pricing model and egress

The defining feature of R2 is that data transfer out is not billed. Conventional object stores charge per gigabyte delivered to the internet, and these egress fees often exceed the cost of storing the data itself. R2 instead bills for stored capacity and for operations, split into Class A operations (writes, lists and other mutating calls) and Class B operations (reads such as GET and HEAD).

The table below lists the billing dimensions at the published list rates at the time of writing; prices change, so current figures should always be confirmed before capacity planning.

DimensionStandard classInfrequent Access class
StorageAbout $0.015 per GB-monthAbout $0.01 per GB-month
Class A operationsAbout $4.50 per millionAbout $9.00 per million
Class B operationsAbout $0.36 per millionAbout $0.90 per million
Data retrievalFreeAbout $0.01 per GB
Minimum storage durationNone30 days
Egress to the internetFreeFree
Billing dimensions of Cloudflare R2

A monthly free tier of 10 GB of Standard storage, one million Class A and ten million Class B operations covers small projects. The Infrequent Access storage class lowers capacity cost for rarely read data, but its retrieval fee and 30-day minimum make it unsuitable for objects that are read or deleted soon after upload.

Cloudflare R2 compared with other object stores

R2 competes most directly with Amazon S3, which defines the de facto API, and with Backblaze B2, another low-cost S3-compatible storage provider. The comparison below focuses on the differences that usually decide an architecture.

AspectCloudflare R2Amazon S3Backblaze B2
Internet egressFreeBilled per GB after a small allowanceFree up to a multiple of stored data
Storage classesStandard and Infrequent AccessMany, including archive tiersSingle class
API compatibilityLarge subset of S3Reference implementationLarge subset of S3
Edge compute integrationNative Workers bindingLambda and CloudFrontThrough partners
Archive tierNoneGlacier classesNone
R2 against common alternatives

The S3 compatibility is broad but not complete. Core calls such as PutObject, GetObject, ListObjectsV2 and multipart upload behave as expected, while some features, for example certain ACL semantics, S3 Select and several bucket-level settings, are absent or implemented differently. Object versioning has historically been limited compared with S3, so designs that rely on version history should be verified against the current feature list.

Features for migration, governance and data locality

Cloudflare provides two migration tools for moving data from other S3-compatible stores. Super Slurper performs a bulk copy of an entire bucket, while Sippy performs incremental migration: objects are copied into R2 the first time they are requested, so traffic shifts gradually without a large one-time transfer bill from the source provider.

  • Object lifecycle rules delete objects or move them to Infrequent Access after a set number of days.
  • Bucket locks prevent deletion or overwriting for a retention period, supporting compliance requirements similar in intent to S3 Object Lock.
  • Jurisdictional restrictions keep data within a defined boundary, such as the European Union, for data residency obligations.
  • Event notifications send messages to a queue when objects are created or deleted, enabling event-driven processing.
  • CORS policies control which web origins may access a bucket directly from browsers.

Choosing R2 for a workload

R2 delivers the greatest benefit when the ratio of reads to stored data is high. A dataset that is downloaded many times per month accumulates egress charges quickly on traditional providers, while on R2 the cost stays tied to capacity and operation counts. The decision table below captures typical outcomes.

SituationRecommendationReason
Public media or software downloadsStrong fitEgress dominates cost elsewhere
Multi-cloud data shared across providersStrong fitNo transfer fees when other clouds read data
Deep archive kept for many yearsPoor fitNo archive tier with very low capacity pricing
Workloads tightly bound to one hyperscalerEvaluate carefullyNative services and IAM may outweigh savings
Very high request rates on small objectsModel operation costsClass A and B charges become the main cost
When R2 fits and when it does not

Common mistakes include assuming full S3 feature parity, leaving the r2.dev subdomain enabled for production traffic, storing short-lived objects in Infrequent Access and ignoring request costs for chatty workloads. Credentials should be scoped with least-privilege API tokens limited to specific buckets and permissions.

Put simply

Cloudflare R2 is a large online warehouse for files. You pay rent for the shelf space and a small fee each time someone puts a box on a shelf or takes one off, but nobody charges you for the delivery truck that carries files out to your visitors.

That matters because many storage providers charge for every gigabyte that leaves their warehouse. If your files are downloaded often, those delivery charges can become the largest part of the bill. With R2, popular files cost the same to store whether one person downloads them or a million people do, apart from the small per-request fee.

In practice

A small company that distributes a desktop application publishes installers of about 400 MB each. After a major release, roughly 200,000 downloads per month produce about 80 TB of outbound traffic. On a storage provider that bills internet egress per gigabyte, transfer charges for that volume run into thousands of dollars every month, far more than the cost of storing a few hundred gigabytes of release files.

The team moves the release bucket to R2 using Sippy, so files copy over as users request them, and serves downloads through a custom domain behind the Cloudflare cache. Its build pipeline uploads new installers through the S3 API with a token restricted to that single bucket. The monthly bill drops to storage plus read operations, a few dollars in total, and the existing upload scripts needed only a new endpoint and new credentials.