Skip to content
ENExplore Calculators

Rate Limit Calculator

Calculate appropriate API rate limit thresholds based on capacity and client demand.

About Rate Limit Calculator

The token bucket algorithm allows short bursts up to the bucket's full capacity, while limiting the long-run sustained rate to the refill rate: allowed_rps = bucket_size ÷ refill_interval ÷ request_cost. A larger bucket size permits bigger bursts without changing the sustained rate, while a shorter refill interval increases the sustained rate a client can maintain indefinitely — the two parameters are independent knobs for burst tolerance versus steady-state throughput.

Formula

allowed_requests = rate_limit × window_seconds

rate_limit
Maximum requests per second allowed
window_seconds
Rate limit window duration (seconds)

Worked example

With the default values below, Rate Limit Calculator returns Sustained Allowed RPS of 10.000. Change any input above and every figure here is recalculated in your browser.

Inputs used

Bucket Sizeaccepts 1–10,000,000 tokens
100 tokens
Refill Intervalaccepts 0.001–100,000 seconds
10 seconds
Cost per Requestaccepts 0.01–100,000 tokens
1 tokens

Results

Sustained Allowed RPS
10.000 requests/sec
Max Burst Requests
100.0 requests
Sustained Rate
600.0 requests/min
Token Refill Rate
10.000 tokens/sec

Step by step

  1. 1Sustained refill rate: bucket size ÷ refill interval= 10.000 tokens/sec
  2. 2Allowed RPS: refill rate ÷ cost per request= 10.000 req/sec
  3. 3Max burst: bucket size ÷ cost per request= 100.0 requests

Assumptions and limits

  • The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax or compounding frequency into account.
  • Figures are rounded for display to 3 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

What's the difference between bucket size and refill rate?

Bucket size controls how large a burst is tolerated (how many requests can fire instantly after the bucket is full); refill rate (bucket_size ÷ refill_interval) controls the long-run sustained rate — they can be tuned independently to allow bursty traffic patterns while still bounding average load.

How is a token bucket different from a fixed window counter?

Fixed window counters reset abruptly at interval boundaries, which allows a client to send 2x the intended rate right at a window edge; token bucket (and its close relative, leaky bucket) smooths this out by continuously refilling, avoiding the edge-of-window burst problem.

What request cost should I use for expensive endpoints?

Weight expensive operations (e.g. bulk exports, complex search queries) with a higher token cost than simple reads, so the same bucket capacity naturally throttles resource-intensive requests more aggressively without needing a separate limiter per endpoint.

How do I choose bucket size for a good user experience?

Size the bucket to comfortably accommodate legitimate burst patterns (e.g. a page load firing several parallel API calls) while still being small enough that a misbehaving or malicious client can't cause a meaningful spike — profile real traffic patterns rather than guessing.

Rate Limit Calculator – Calculate Sustained Allowed RPS