Productivity and Utilities

Rate Limit Bucket Simulator

Enter the bucket size, the refill rate and your request times to see exactly which requests a token bucket would allow.

Your numbers

The most tokens the bucket can hold, which is also the largest burst.

Leave blank for a full bucket.

One per line or separated by commas. Write time:cost (such as 2.5:3) for a request that costs more than 1 token. Times must not go backward.

Result

Allowed requests

8 of 11

3 requests were rejected.

Allowed
8
Rejected
3
Tokens left at the end
2
Long run limit
1 tokens per second
Time covered
5 seconds
Time to refill an empty bucket
5 seconds

Each request

No.Time (s)CostTokens beforeResultTokens afterRetry at (s)
1015Allowed4
20.114.1Allowed3.1
30.213.2Allowed2.2
40.312.3Allowed1.3
50.411.4Allowed0.4
60.510.5Rejected0.51
71.511.5Allowed0.5
8211Allowed0
92.110.1Rejected0.13
102.210.2Rejected0.23
11513Allowed2
How this was calculated
  1. Before each request the bucket gains (seconds since the last request) x refill rate tokens, up to the bucket size.
  2. If the bucket holds at least the request cost, the request is allowed and the cost is taken out. Otherwise it is rejected and nothing is taken.
  3. For a rejected request, the retry time is the request time plus (cost - tokens) / refill rate.
  4. The bucket size sets the largest burst. The refill rate sets the long run average.
  • This models one common token bucket. Real services vary: some count rejected requests, use whole-token refills, share a bucket across servers or use a different algorithm. Check the service you use.

Calculated using SumPanda.com · https://sumpanda.com/rate-limit-bucket-simulator/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the rate limit bucket simulator

  1. Enter the bucket size, the refill rate in tokens per second and, if you want, the tokens at the start. Leave the start blank for a full bucket.
  2. List your request times in seconds, one per line. Write time:cost for a request that costs more than 1 token.
  3. Read the headline for how many requests were allowed, then the table for each request.
  4. Change the bucket size or the refill rate and see how bursts and the long run average change.

Formula

tokens before a request = min(bucket size, tokens left + seconds since the last request x refill rate)

allowed if tokens before >= the request cost; then tokens left = tokens before - cost

retry time for a rejected request = request time + (cost - tokens) / refill rate

A rejected request takes no tokens. The bucket size sets the largest burst and the refill rate sets the long run average. Times must not go backward.

A burst of requests

The bucket holds 5 tokens and refills at 1 token per second. Requests arrive at 0, 0.1, 0.2, 0.3 and 0.4 seconds, using up 5 tokens in all, so all five are allowed and the bucket holds 0.4 tokens at 0.4 seconds. A request at 0.5 seconds finds only 0.5 tokens and is rejected, with a retry time of 1.0 seconds.

At 1.5 seconds the bucket holds 1.5 tokens and the request is allowed, leaving 0.5. At 2.0 it holds 1.0 and is allowed, leaving 0. Requests at 2.1 and 2.2 are rejected, and one at 5.0 is allowed. In all, 8 of the 11 requests are allowed.

Burst and average

A token bucket lets a client send a burst up to the bucket size, then slows it to the refill rate. This is why many APIs use it: short spikes are fine, but a steady flood is held to the average. A larger bucket allows bigger bursts, and a higher rate raises the long run limit.

Where services differ

Real services vary in the details. Some refill in whole tokens at fixed ticks instead of continuously, some count rejected requests, some share one bucket across several servers, and some use other methods such as a fixed window or a leaky bucket. Use this page to understand the behavior of one common model, then read your service's documentation. For related tools, see the Exponential Backoff Schedule Generator, the Uptime and Downtime Calculator and the Cron Expression Generator.

Assumptions and limits

  • Refill is continuous and a request is allowed when the bucket holds at least its whole cost.
  • A rejected request does not use tokens and is not retried by the model.
  • Up to 2,000 requests are handled, in time order.
  • The simulation is a model, not a test of any real service.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

What is the difference between bucket size and refill rate?

The size is the most tokens that can be saved up, which sets the biggest burst. The refill rate is how fast tokens return, which sets the average rate over a long time.

Can a request cost more than one token?

Yes. Write the time, a colon and the cost, such as 2.5:3. A costly request is allowed only when the bucket holds at least that many tokens.

What does the retry time mean?

It is the earliest time at which the bucket would hold enough tokens for that request, if no other request took tokens in the meantime.

Why did my list fail?

Request times must be numbers and must not go backward. A line with a cost of zero or a negative time is also rejected, and the message names the entry.