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.
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
- The probability of finding 5 Heads in a row (course note, 2S540) — Eindhoven University of Technology
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