Have a static website — maybe your portfolio, a landing page, or a small project — and wondering where to host it for free?
Good news: you can do it with Cloudflare R2, and the best part? No egress fees, no servers, and super-fast loading speeds with Cloudflare's global CDN.
Let’s walk through how you can get your site live using R2 — step by step.
What is Cloudflare R2?
Cloudflare R2 is a cloud object storage service, kind of like Amazon S3, but with a big difference: no bandwidth charges (egress fees). That makes it perfect for hosting static websites.
You can store your HTML, CSS, JS, and image files — and serve them directly to users through Cloudflare’s global CDN.
Why Use R2 for Hosting Static Sites?
- It’s completely free for light to moderate use
- No egress fees — no traffic-based billing
- Files are distributed globally for super-fast loading
- HTTPS enabled automatically
- No backend needed — just upload and go live
- Perfect for portfolios, documentation pages, and more
How to Host Your Static Site with R2
1. Create a Cloudflare Account
Go to dash.cloudflare.com and sign up (it’s free).
2. Create an R2 Bucket
- Go to R2 in the dashboard and click Create Bucket
- Name it (e.g.,
my-portfolio-site
) - Note the bucket URL (e.g.,
https://my-portfolio-site.r2.dev/
)
3. Upload Your Website Files
You can upload files manually or use a CLI tool:
- Option A: Manual Upload
- Open the bucket
- Upload
index.html
,style.css
, images, etc. - Option B: Use rclone CLI
- For syncing your entire website folder easily:
- Install rclone:
curl https://rclone.org/install.sh | sudo bash
- Set up rclone:
rclone config
- Create a new remote (name it
cloudflare-r2
) - Choose S3 as the storage type
- Enter R2 credentials and use this as the endpoint:
https://<your-account-id>.r2.cloudflarestorage.com
- Upload your site folder
rclone copy ./site cloudflare-r2:my-portfolio-site
4. Make Your Bucket Public
Go to bucket settings → Permissions → Enable public access.
Test your R2 URL in the browser — if index.html
is uploaded, it should load!
5. Use a Custom Domain (Optional)
- Set up your domain on Cloudflare
- Create a CNAME record pointing to your bucket URL
- Use a Cloudflare Worker to clean up routes (e.g., redirect
/
to/index.html
)
What Kind of Sites Can You Host?
- Personal portfolios
- Landing pages
- Resume sites
- Documentation pages
- Image galleries
As long as it's static files (HTML, CSS, JS, media), you're good to go!
Conclusion
Thanks to Cloudflare R2, hosting a static website for free is now simpler than ever. With affordable storage, built-in CDN, and easy setup, you can focus on your content — not infrastructure.
Whether it's a portfolio, blog, or business site — start today and enjoy fast, reliable, and cost-free website hosting!