Rate limiting explained in plain terms means understanding how a service protects itself from being overwhelmed by too many requests at once. The central question is how an API can stay fast and fair when one client sends far more traffic than the rest, and the answer is a limit: each client gets a fixed allowance of requests, and anything beyond it is slowed down or refused.
Rate limiting is the practice of controlling how many requests a client, a user, or an address can make to a service in a given period. When the limit is reached, further requests are rejected with an error, usually HTTP 429, or queued until capacity frees up, so that the service stays available for everyone else.
The idea is simple: a service has finite capacity, and demand is effectively infinite, so someone must decide who gets served. A limit spreads that capacity fairly, stops a single client from starving the rest, and gives the service a predictable load it can plan for. This article explains what rate limiting is, how it works, and where it is used.
Key takeaways
- Rate limiting caps how many requests a client can make in a period.
- It keeps one heavy client from starving all the others.
- Token buckets, fixed windows, and leaky buckets are the main algorithms.
- Limits are usually set per user, per key, or per address.
- Clients should back off and retry when they hit a limit.
What rate limiting is
Rate limiting is a form of traffic control, applied at the edge of a service, in an API gateway, or inside the application itself. A limit is expressed as a number of requests over a period, such as 100 requests per minute, or 10,000 per day, and the service counts each client’s requests against that allowance as they arrive.
Limits serve several purposes at once. They protect a service from accidental overload, such as a buggy client retrying in a loop, and from deliberate abuse, such as a bot hammering an endpoint. They also make capacity planning possible, because the maximum load is bounded by the sum of the limits, and they support fair pricing, since a paid plan can simply be a higher limit.
A limit is not a punishment, and it is not a sign that a client did something wrong. It is a normal part of how shared services work, like a speed limit on a road, and well-designed clients treat a limit as a signal to slow down rather than as an error. Our guide to REST APIs explains the interfaces where limits are most often applied, and our guide to the token bucket explains the algorithm that most limiters are built on.
How rate limiting works
The token bucket is the most widely used algorithm. Each client has a bucket that fills with tokens at a steady rate, up to a maximum, and each request costs one token. If the bucket has a token, the request proceeds; if it is empty, the request is refused. The bucket allows short bursts, because a client that has been idle can spend its saved tokens at once, while still capping the long-term rate.
The fixed window is simpler. The service divides time into windows, such as one minute each, and counts requests per window. A client may make up to the limit in a window, and the count resets when the next window begins. The weakness is the boundary: a client can make a full allowance at the end of one window and another at the start of the next, doubling its rate for a moment.
The sliding window fixes the boundary problem by counting requests over a rolling period. Instead of resetting at a fixed moment, it looks back over the last minute from now, so the allowance is always measured over the most recent requests. It is more accurate than a fixed window, but it needs more memory, since the service must remember when each request happened.
The leaky bucket smooths traffic instead of counting it. Requests enter a queue that drains at a fixed rate, and a request that arrives when the queue is full is refused. The result is a perfectly steady flow out of the bucket, which suits services that need a constant rate, but it does not allow bursts at all, which makes it a poor fit for clients that work in short, intense spells.
Enforcement needs a shared counter when a service runs on many machines. The counters are usually kept in a fast in-memory store, such as Redis, so that every server sees the same count for a client. The store is updated on each request, and the small delay of that update is the price of a limit that works consistently across the whole fleet.

Comparing rate limiting with other traffic controls
Rate limiting is one of several ways to control traffic, and each solves a different part of the problem. A token bucket allows bursts, a fixed window is simple to build, and a leaky bucket smooths the flow entirely, but each approach fits a different kind of client.
The table below sets out the main contrasts between the leading approaches.
| Aspect | Token bucket | Fixed window | Leaky bucket |
|---|---|---|---|
| How it works | Tokens refill steadily | Count resets each window | Queue drains steadily |
| Bursts allowed | Yes, up to the bucket size | Yes, at window edges | No, flow is constant |
| Accuracy | Good, smooth average | Weak at boundaries | Exact, by construction |
| Memory needed | One counter per client | One counter per client | One queue per client |
| Best for | General API limits | Simple quotas | Steady-rate services |
The practical result is that a token bucket is the right default for most APIs, a fixed window suits simple quotas where the boundary effect does not matter, and a leaky bucket fits services that need a perfectly steady rate.
Where rate limiting is used
Public APIs use rate limiting to protect their backends and to enforce pricing tiers. A free plan might allow 100 requests per minute, while a paid plan allows 10,000, and the limit is checked on every request using the client’s API key, so that the service can serve millions of developers without any one of them overwhelming it.
Login pages use rate limiting to slow down password guessing. After a few failed attempts from one address, further attempts are delayed or blocked, which makes a brute-force attack impractical while barely affecting a legitimate user who mistyped a password once or twice.
Web servers use rate limiting to survive traffic spikes. When a page goes viral, the flood of requests is capped per address, so the server keeps answering the users it can serve instead of collapsing under the load and answering nobody.
Payment systems use rate limiting to prevent duplicate charges. A client that retries a payment aggressively is throttled, which gives the first attempt time to complete, and avoids the case where a retry creates a second charge while the first is still being processed.
Cloud services use rate limiting to protect shared resources. A storage service, a database, or a message queue all cap the rate at which a single tenant can consume capacity, so that one tenant’s burst cannot degrade the service for everyone else on the same hardware.
Strengths and limits
The greatest strength of rate limiting is that it makes load predictable. When every client has a known maximum rate, the service can be sized for the worst case, and a single misbehaving client can never take the whole system down, which is why limits are one of the first defences any public service puts in place.
It is also a strength that rate limiting is fair in a visible way. A limit is a rule that applies equally to everyone at the same tier, and it can be raised transparently as a client pays more or proves it needs more, which makes it a natural part of how a service is sold.
The limits are real, though. A limit set too low frustrates legitimate users and breaks clients that legitimately burst, while a limit set too high offers no protection at all. Limits also need care with shared addresses, since many users behind one corporate network or one mobile carrier can share a single address and hit a limit together.
Rate limiting checklist
- Set limits per user or per key, not only per address.
- Return HTTP 429 with a Retry-After header when a limit is hit.
- Publish limits in headers so clients can see their allowance.
- Allow bursts with a token bucket rather than a hard cutoff.
- Use different limits for reads and for expensive writes.
- Share counters across servers so limits hold fleet-wide.
- Test clients against the limit; they must back off, not spin.
- Review limits regularly as traffic and capacity change.
- Never use rate limiting as the only defence against abuse.
Frequently asked questions
What is rate limiting in simple terms?
It is a cap on how many requests a client can make to a service in a given time, so that no single client can overwhelm the service or starve the others.
What is the difference between a token bucket and a fixed window?
A token bucket refills steadily and allows bursts up to the bucket size, while a fixed window counts requests in a set period and resets at the boundary, which lets a client double its rate across the edge of two windows.
What does HTTP 429 mean?
It means too many requests: the client has hit a rate limit. A well-behaved client waits for the time given in the Retry-After header, or backs off, and tries again later.
Should limits be per user or per address?
Per user or per API key is fairer, because many users can share one address behind a corporate network or a mobile carrier. Per-address limits are a fallback for anonymous traffic.
How do I choose the right limit?
Start from the capacity of the service and the number of clients, set the limit so the worst case is survivable, and watch real traffic. Raise limits for clients that legitimately need more, and lower them for endpoints that are expensive.
When should I not use rate limiting?
When the service is private and trusted, when the traffic is already controlled upstream, or when the limit would break a legitimate burst that the service can actually handle. In those cases, monitoring and alerting may be enough.
The bottom line
Rate limiting explained in one line is this: give every client a fair allowance, and refuse the rest, so the service stays up for everyone.
It is the simplest defence a shared service has, and the reason one heavy client can never take the whole system down.
This article is general information about how rate limiting works, not advice about setting limits for a particular service.







