Skip to content

Optimize costs

Reducing usage-based charges starts with understanding where your consumption comes from. Use the billable usage dashboard to identify which products are driving costs, then apply the strategies below.

General strategies

StrategyImpact
Set up budget alerts to catch unexpected spikes earlyPrevents surprise invoices across all products
Review the billable usage dashboard weekly to identify cost trendsCatches runaway costs before the invoice arrives
Understand how charges accrue across the request lifecycleIdentifies which stage of a request generates the most cost

Per-product optimization

Cache and CDN

Cached responses are the cheapest path through Cloudflare. Every cache hit avoids origin fetch costs, Argo routing charges, and Workers execution.

StrategyWhat it reduces
Increase cache hit ratio with longer TTLs and appropriate Cache-Control headersArgo data transfer, Workers invocations, origin load
Use Cache Reserve for long-tail content that is accessed infrequentlyOrigin fetches — keeps content cached even when it would normally be evicted
Use tiered caching to reduce origin pullsOrigin bandwidth and Argo transfer between Cloudflare data centers
Configure cache rules to cache more static content by defaultOverall cache hit ratio

Workers & Durable Objects

StrategyWhat it reduces
Use Workers Logs for log retention instead of LogpushLogpush-enabled Workers requests and Logpush data transfer
Use the WebSocket Hibernation API for Durable Objects with idle WebSocket connectionsDuration (GB-s) charges — billing pauses while the Durable Object is hibernated

R2

StrategyWhat it reduces
Use R2 lifecycle rules to transition cold data to the Infrequent Access storage classStorage costs for archival data
Batch R2 operations where possible instead of per-object readsClass B operation count
Use presigned URLs for direct client access instead of proxying through WorkersWorkers invocations and CPU time
Enable Cache-Control headers on R2 objects to leverage Cloudflare's CDN cacheClass B reads — cached objects do not hit R2

Stream and Images

StrategyWhat it reduces
Set appropriate cache headers on Stream embed pagesRepeated Stream delivery minutes
Use Image Resizing URL format with width/height parameters to serve appropriately sized variantsTransformation count — sized variants are cached

Load Balancing

StrategyWhat it reduces
Set health check intervals to the longest acceptable value for your availability requirementsDNS queries to load-balanced hostnames
Use fewer health check regions where regional redundancy is not criticalHealth check frequency multiplier

Monitor and alert

Visibility is the foundation of cost optimization. Cloudflare provides two complementary tools:

  1. Billable usage dashboard — shows daily usage-based costs per product with a chart and sortable table. Available to Pay-as-you-go accounts.
  2. Budget alerts — sends an email notification when your total spend crosses a dollar threshold you define.

For per-product usage notifications (bytes, requests, minutes), configure usage-based billing notifications in the Cloudflare dashboard.