Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path
Exponential Backoff Calculator
An interactive exponential-backoff calculator. Set the base delay, multiplier, cap and retry count, then see the exact delay before every retry attempt, the worst-case total wait, and how full and equal jitter change the numbers — so you can size retries that recover fast without hammering a service that is already struggling.
Delay before each attempt
| # | No jitter | Full jitter 0 … delay | Equal jitter ½ … full |
|---|---|---|---|
| 1 | 100 ms | 0 – 100 ms | 50 ms – 100 ms |
| 2 | 200 ms | 0 – 200 ms | 100 ms – 200 ms |
| 3 | 400 ms | 0 – 400 ms | 200 ms – 400 ms |
| 4 | 800 ms | 0 – 800 ms | 400 ms – 800 ms |
| 5 | 1.60 s | 0 – 1.60 s | 800 ms – 1.60 s |
| 6 | 3.20 s | 0 – 3.20 s | 1.60 s – 3.20 s |
| 7 | 6.40 s | 0 – 6.40 s | 3.20 s – 6.40 s |
| 8 | 12.8 s | 0 – 12.8 s | 6.40 s – 12.8 s |
Expected total with equal jitter: 19.1 s. Jitter values are the statistical mean and range — each real retry draws a fresh random delay inside that range.
Exponential backoff is the standard way to retry a failed request without making the failure worse. Each retry waits longer than the last by a fixed multiplier, up to a cap. This calculator prints the exact schedule, marks the retry where the cap takes over, and adds up what a caller could end up waiting, with and without jitter.
What it computes
delay(k) = min(cap, base × multiplier^(k − 1)) retry k = 1, 2, …
worst case = Σ delay(k) no jitter
full jitter = random in [0, delay(k)] mean = delay(k) / 2
equal jitter = random in [delay(k) / 2, delay(k)] mean = 0.75 × delay(k)
- Base delay is the wait before the first retry, in milliseconds.
- Multiplier is the growth per retry; 2 doubles each time.
- Cap is the largest single wait allowed. Once
base × multiplier^(k − 1)passes it, every remaining retry waits exactly the cap. - Retry attempts sets how many rows to compute, from 1 to 20.
The jitter columns are ranges, because each real retry draws a fresh random delay. The headline expected total, full jitter and the footnote’s equal-jitter total are the sums of the means. Durations print in milliseconds, then seconds, then minutes and seconds.
A worked example
The defaults are a 100 ms base, a multiplier of 2, a 20,000 ms cap and 8 retries.
| Retry | No jitter | Full jitter range | Equal jitter range |
|---|---|---|---|
| 1 | 100 ms | 0 – 100 ms | 50 ms – 100 ms |
| 2 | 200 ms | 0 – 200 ms | 100 ms – 200 ms |
| 3 | 400 ms | 0 – 400 ms | 200 ms – 400 ms |
| 4 | 800 ms | 0 – 800 ms | 400 ms – 800 ms |
| 5 | 1.60 s | 0 – 1.60 s | 800 ms – 1.60 s |
| 6 | 3.20 s | 0 – 3.20 s | 1.60 s – 3.20 s |
| 7 | 6.40 s | 0 – 6.40 s | 3.20 s – 6.40 s |
| 8 | 12.8 s | 0 – 12.8 s | 6.40 s – 12.8 s |
- Worst case:
100 + 200 + … + 12,800 = 25,500 ms, shown as 25.5 s. The cap never bites, because the largest delay is 12.8 s. - Full jitter averages half of each delay:
12,750 ms, shown as 12.8 s. - Equal jitter averages three quarters:
19,125 ms, shown as 19.1 s.
Raise the retries to 10 and the ninth retry would want 25.6 s, so the cap note appears at attempt 9, retries 9 and 10 both wait 20 s, and the worst case jumps to 65.5 seconds, shown as 1m 6s. Two extra attempts more than doubled the possible wait.
Assumptions and limits
- Waiting time only. The totals ignore how long each failed attempt itself takes. A request that times out after 5 seconds adds 5 seconds per retry on top of the schedule.
- Means, not samples. Jitter totals are averages. Any single client can wait anywhere inside the ranges, and the no-jitter column is the upper bound for both.
- Two jitter styles. Decorrelated jitter, which sets each sleep to
min(cap, random(base, previous × 3)), is not tabulated. - No retry policy. The tool does not decide which errors deserve a retry, honor a server’s Retry-After header or model a shared retry budget.
How to use the result
- Fit the worst case into your latency budget. If a user-facing call can wait 3 seconds in total, eight doubling retries from 100 ms cannot fit; use fewer retries or a lower cap.
- Always add jitter when many clients share a dependency, and default to full jitter.
- Retry only safe operations. Idempotent requests, or ones carrying an idempotency key, can be retried; others can double-charge or double-write.
- Pair retries with a circuit breaker or retry budget so a dependency that is truly down stops receiving retries instead of being buried by them.
When to use it, and when not
Use it whenever you write or review a retry loop: an HTTP client, a queue consumer, a job that calls a flaky API. Type in the numbers from the code and read off two things the code never states: the longest a caller can wait, and the retry where the cap takes over. Compare those with the caller's timeout and with how long a person will actually wait.
Do not retry errors that will not change. A 400 Bad Request, a failed validation or a rejected credential fails the same way every time, and backoff only delays the error. Backoff helps with failures that clear on their own: timeouts, dropped connections, 429 and 503. When the server sends a Retry-After header, use it instead of the schedule. The server is telling you when it expects to have room.
Trade-offs and limits
| Ignored | How wrong it can be |
|---|---|
| Time spent in each attempt | The defaults make 9 attempts, the first plus 8 retries. If each times out after 2 s, that adds 18 s, and the worst case grows from 25.5 s to 43.5 s |
| Spread of a single client | The jitter totals are means. With full jitter one client's total can land anywhere from near 0 to 25.5 s |
| The dependency's load | Retries help with blips. Against an overloaded service each retry is extra load at the worst moment, which only a budget or breaker can stop |
| An overall deadline | A caller with a 10 s deadline never reaches retry 7, whose sleep would end at 12.7 s. Check the time left before each sleep and stop when the next sleep would pass it |
Jitter is a trade between spread and a guaranteed floor. Full jitter spreads retries the most but can retry almost at once. Equal jitter always waits at least half the backoff and spreads over half the range. Both cost the same in the worst case, because the top of every range is the unjittered delay.
Common mistakes
- An off-by-one exponent. Using
base × multiplier^kfromk = 1makes the first retry 200 ms, not 100 ms. The cap then bites at retry 8, and the default worst case grows from 25.5 s to 45.4 s. - A base delay of zero. Zero times any power of the multiplier is zero, so every retry fires at once. Code that defaults the base to 0 for "retry immediately the first time" has no backoff at all.
- Generous retry counts. Twenty retries at the defaults can wait 4m 26s. The first 8 take 25.5 s; the other 12 sit at the 20 s cap and add 240 s. Few callers still care by then.
- Retrying at every layer. If a browser, a gateway and a service each make 3 attempts, one user action can send
3³ = 27requests to the database. Retry at one layer, usually the one closest to the failure. - The same random seed everywhere. Containers started from one image with a fixed seed draw identical "random" delays, which puts the herd back in lockstep. Seed from a real entropy source.
Check yourself
Base 200 ms, multiplier 3, cap 10,000 ms, 6 retries. What is the schedule and the worst case?
200 ms, 600 ms, 1.80 s, 5.40 s, then 16.2 s and 48.6 s, both capped to 10.0 s, so the cap note appears at retry 5. The worst case is 28,000 ms, 28.0 s. Full jitter expects half, 14.0 s, and equal jitter three quarters, 21.0 s.
A user-facing call has 3 seconds in total. Base 100 ms, multiplier 2. How many retries fit?
Four retries wait 100 + 200 + 400 + 800 = 1,500 ms; a fifth makes 3.10 s. If each of the 5 attempts can take 300 ms, that adds 1.5 s, and four retries use the whole 3 seconds.
1,000 clients fail at the same instant. How crowded is retry 3 with no jitter, full jitter and equal jitter?
Retry 3 waits 400 ms. Without jitter all 1,000 arrive at the same moment. Full jitter spreads them over 0 to 400 ms, about 2.5 per millisecond. Equal jitter spreads them over 200 to 400 ms, about 5 per millisecond.
At the defaults, does raising the cap from 20 s to 40 s change anything?
No. The largest delay at 8 retries is 12.8 s, below either cap. The cap only matters from retry 9, where 25.6 s would be held to 20 s.
How it works
- Delay before retry k = min(cap, base × multiplier^(k−1)).
- Full jitter draws each delay from [0, backoff]; equal jitter from [backoff / 2, backoff].
- Worst-case total wait sums the capped delays across every retry attempt.
- Shows where the cap takes over; up to 20 retries, computed in your browser.
Frequently asked questions
What is exponential backoff?
Exponential backoff waits progressively longer between retries: each attempt multiplies the previous delay, typically doubling, so a failing request backs off as 100 ms, 200 ms, 400 ms, 800 ms and so on. A cap keeps the delay from growing without bound. The point is to give a struggling or rate-limited service room to recover, instead of hammering it at a fixed interval and keeping it down, while still retrying quickly when the failure was a brief blip.
How do you calculate exponential backoff delays?
The delay before retry k is the base delay times the multiplier raised to k minus 1, limited by the cap. With a 100 ms base, a multiplier of 2 and a 20-second cap, the eight retries wait 100 ms, 200 ms, 400 ms, 800 ms, 1.6 s, 3.2 s, 6.4 s and 12.8 s, for a worst-case total of 25.5 seconds. A ninth retry would want 25.6 s, so the cap holds it at 20 s, and every later retry waits 20 s too.
Why add jitter to backoff?
Without jitter, many clients that failed at the same instant also retry at the same instant, producing synchronized spikes, often called a thundering herd or retry storm, that can keep the service overloaded. Jitter randomizes each delay so retries spread out over time. Full jitter picks a delay uniformly between zero and the current backoff. Equal jitter keeps half the backoff fixed and randomizes the other half, so each wait lands between half the backoff and the full backoff.
Full jitter vs equal jitter: which is better?
Full jitter spreads retries the most. In the widely cited AWS simulation of competing clients, it needed the fewest total calls, while equal jitter did more work and took longer to finish. Equal jitter guarantees a minimum wait, so a near-immediate retry never happens, at the cost of less spread. Full jitter is the usual default; equal jitter suits cases where a retry within a few milliseconds would itself be harmful. Decorrelated jitter is a third option that performed similarly well.
What should the cap and the retry count be?
Work backward from how long the caller can wait. The cap bounds any single sleep, and the retry count bounds how many sleeps there are, so together they set the worst-case total this calculator sums. Background jobs can afford caps of tens of seconds and many retries. User-facing requests usually need a small total, a few seconds at most, so use fewer retries and fail with a clear error rather than leaving someone staring at a spinner.