Coin Streak Probability Calculator

Exact probability of a streak of k heads in a row (or k of the same side) somewhere in n coin flips, plus the expected longest streak.

A whole number up to 1,000,000.
A streak of at least this many in a row counts; longer streaks are included.
0.5 for a fair coin. Use any success chance for other repeated trials, such as 0.55 for a team winning each game.

Results

P(at least one streak of 5+ heads in 20 flips)
0.24987
P(no streak of 5 heads in a row)
0.75013
Expected longest streak of heads
3.7292

How it’s calculated

Streaks are far more common than intuition suggests. To get the exact chance of at least k heads in a row somewhere in n flips, the calculator tracks how many heads the sequence currently ends with (0, 1, …, k − 1). Each flip either extends that run (heads, chance p) or resets it to 0 (tails, chance 1 − p); reaching k ends the search. This is a small Markov chain, solved exactly step by step for every flip.

P₀(i, m): chance of reaching a run of k with m flips left, current run i P₀(i, m) = p · P₀(i + 1, m − 1) + (1 − p) · P₀(0, m − 1) P₀(k, m) = 1, P₀(i, 0) = 0 for i < k Answer = P₀(0, n)

For “either side” the run length is tracked separately for heads and tails. The expected longest streak adds up P(longest ≥ j) for j = 1, 2, 3, …, each from the same calculation.

Worked example (Eindhoven University of Technology, “The probability of finding 5 Heads in a row”): in 20 flips of a fair coin the chance of at least five heads in a row is 0.2499, about 1 in 4. Allowing five tails in a row as well raises it to 0.4584. A small check by hand: in 3 flips there are 8 equally likely sequences and 3 of them (HHH, HHT, THH) contain HH, so P(2 heads in a row) = 3/8 = 0.375.

Frequently asked questions

Does a longer streak count?

Yes. “A streak of 5” means at least 5 in a row, so a run of 7 heads counts once. The calculator gives the chance of at least one such streak anywhere in the n flips.

Can I use it for things other than coins?

Yes, for any independent repeated trials with the same success chance p on every trial: free throws, games won, days of rain. Enter the success chance as p.

Why is a streak so likely?

A streak can start at almost any position, so there are many chances for one to appear. In 100 fair flips, the longest run of heads is usually around 5 or 6, and a run of at least 6 heads happens more often than not.

Is there a size limit?

The calculation does about n × k steps, so it is limited to 20,000,000 (for example a million flips with a streak of up to 20). The expected longest streak needs more work and is skipped for the largest inputs.

Embed this calculator

Add this free calculator to your own website. Copy the code below into your page’s HTML:

Need this calculator branded, changed or built around your own prices?See custom business solutions →

Sources

Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.

Added · Last updated · How we check our calculators

Spotted a mistake or missing option? Report a problem· Suggest a calculator