1. Home
  2. Developer tools
  3. Rate Limit Simulator

Rate Limit Simulator

Choose an algorithm and numbers for an API limit by watching how each one treats real-looking traffic.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use Rate Limit Simulator

  1. Pick an algorithm and set the bucket or window size and rate.
  2. Choose a traffic pattern and volume.
  3. Compare the per-second chart and totals.

Features

  • Token bucket, leaky bucket, fixed window and sliding window log
  • Burst, steady and spiky traffic patterns
  • Allowed and rejected (429) per second
  • Sustained rate and burst size side by side
  • RateLimit-Policy and Retry-After header examples

Supported formats

Input

  • Form input

You get

  • Screen view

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the Rate Limit Simulator is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Simulates a single limiter with idealised traffic; distributed limiters add clock and synchronisation effects.

Guide

Token bucket, leaky bucket and window rate limits compared

Every public API needs a rate limit, both to protect the service and to share it fairly between clients. The common algorithms sound similar on paper but treat bursts very differently, and the right numbers depend on how your clients actually behave. This simulator runs the four classic algorithms on the same traffic and shows, second by second, which requests get through.

Token bucket

A bucket holds up to a fixed number of tokens and starts full. Each request takes one token, and tokens are added back at a steady rate. A client can therefore send a burst as large as the bucket at once, then continue at the refill rate. This matches how people use APIs, quick bursts followed by pauses, which is why token buckets are the most common choice for public APIs.

Leaky bucket

A leaky bucket is a queue that drains at a constant rate. Requests are accepted while the queue has room and rejected once it is full. The effect is the opposite emphasis from a token bucket: output is smoothed to a steady rate, which protects a downstream system that cannot handle bursts, at the cost of delaying or rejecting clients that send in bursts.

Fixed and sliding windows

A fixed window counts requests per clock interval, such as per second or per minute, and resets the counter at each boundary. It is cheap to implement with a single counter, but a client can send a full window’s worth at the end of one window and again at the start of the next, briefly doubling the allowed rate. A sliding window log avoids that by counting the requests in the last N seconds from each new request, at the cost of storing timestamps.

Burst and sustained rate

Every limit has two numbers worth stating: how many requests a client may send at once, and how many per second it may sustain. For a token bucket those are the bucket size and the refill rate; for a window they are the same number spread over the window. The statistics row shows the sustained rate for the settings you chose.

Traffic patterns

The burst pattern sends three seconds’ worth of requests almost at once, then a slow trickle, which is what a client does after reconnecting. The steady pattern spaces requests evenly. The spiky pattern doubles the rate every third second, like a scheduled job running alongside normal traffic. Change the rate and duration to match your clients.

A worked example

With the defaults, a token bucket of 10 refilled at 2 per second, and the burst pattern at 5 requests per second for 10 seconds, the simulation sends 24 requests. The first 10 of the burst are allowed and the next 5 are rejected with 429, because the bucket is empty and refills only 2 tokens per second. By the time the trickle starts at 3 seconds the bucket has refilled, so all 9 later requests pass: 19 allowed, 5 rejected. A fixed window of 10 per second gives the same totals for this pattern, but the chart shows it rejecting at different moments when you try the spiky pattern.

Headers for clients

Rejected requests should get HTTP 429 Too Many Requests with a Retry-After header. The IETF RateLimit header fields, still a draft, add RateLimit-Policy describing the quota and window and RateLimit with what remains, so clients can slow down before hitting the limit. The panel shows example values for the current settings.

What the simulation leaves out

It models one limiter with idealised timing. Real deployments run limiters on several servers that share counters through Redis or a gateway, with clock differences and synchronisation delays, and usually apply several limits at once. Use the simulation to choose the shape and the numbers, then load-test the real implementation.

Checked against the current version of the Rate Limit Simulator on .

Frequently asked questions

Should I rate-limit per user, per IP or per API key?

Per API key or user when requests are authenticated, because many people can share one IP behind a company network or mobile carrier. Per IP is the fallback for anonymous traffic and login pages. Large APIs often combine both, with a generous per-key limit and a stricter per-IP limit on expensive endpoints.

How should a client react to 429 responses?

Wait at least as long as Retry-After says, then retry with exponential backoff and random jitter, so many clients do not retry at the same moment. Clients that ignore 429 and retry immediately make the overload worse and often get blocked for longer.

Token bucket or leaky bucket?

A token bucket allows short bursts up to the bucket size and then the refill rate, which suits APIs used by people. A leaky bucket smooths output to a constant rate, which suits protecting a downstream system that cannot take bursts.

What should a 429 response include?

A Retry-After header with seconds or a date, so clients know when to try again, and ideally the current limit and remaining quota in RateLimit headers. Well-behaved clients back off exponentially with jitter.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.