Search Tools

Token bucket rate limiting and bursts

Simulate the specified token bucket over time to examine bursts and the breakdown of accepted and rejected requests.

A single bucket starts full. A request whose token cost exceeds the current balance is rejected immediately. Rejected requests consume no tokens and are not queued.

A rate of 0 means no refill. Otherwise, tokens refill continuously according to the elapsed time between requests.

The bucket starts full. Capacity and token costs are integers.

Requests by timeRequired
RowElapsed time (s)Token cost (tokens)Actions
1
2

Paste 2 tab-separated columns into the leftmost field. Up to 500 rows.

Use elapsed times relative to a start at 0 s. Enter one request per row, in chronological order. Requests at the same time are evaluated in row order; trailing blank rows are ignored.

Results

Results update automatically when the required values are entered.

Report an issue

Method, applicability and sources

Calculation method

Let B be capacity, R the refill rate (tokens/s), tᵢ the event time and Lᵢ the required tokens. Balance just before the decision = min(B, balance after the previous decision + R×(tᵢ−tᵢ₋₁)). If the balance is at least Lᵢ, accept the request and subtract Lᵢ; otherwise, reject it and leave the balance unchanged. The initial balance is B. Equal timestamps have a difference of 0 s. Displayed values are rounded to at most 9 decimal places; decisions use the unrounded values.

Worked example (hypothetical values)

Example: with a refill rate of 2 tokens/s, capacity 3, and requests (seconds, required tokens) of (0,2), (0,2), (1,2) and (1.5,1), 3 requests are accepted, 1 is rejected and the final balance is 1 token.

Applicability and limitations

One request sequence shares one bucket. Each accepted request consumes its full positive integer token cost at once. Excludes waiting, retries, queuing, smoothing, synchronization between distributed nodes, fixed or sliding windows, multiple buckets, loose conformance, and interpretation of dates or time zones.

Methods used

  • Single token bucket with strict conformance (RFC 3290 (May 2002), Appendix A.4): scope Full initial bucket, capacity limit, continuous refill, and acceptance with full token consumption or rejection in event order; region global

Method and sources

Method: RFC 3290 (2002), §5.1.3 / Appendix A.4; discrete-event calculation with continuous refill, v1. Data recorded: 2026-11-13.