Coin flip streak probability calculator

Is 5 heads in a row within 20 flips rare? The tool gives the exact chance and the average number of flips until the streak appears.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter number of flips n, streak length k, streak of and chance of heads.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Dynamic programming over the current run length after each flip with heads chance p; the answer is 1 minus the chance the run never reaches k. Mean flips to k heads in a row = (1 - p^k) ÷ ((1 - p) × p^k).

Example

Inputs: Number of flips n = 20, Streak length k = 5, Streak of = Heads only, Chance of heads = 0.5. Result: Chance of at least one streak: 0.2498703003; As a percentage: 24.98703%; Chance of no streak: 0.7501296997.

Limits and caveats

  • Assumes independent flips with a fixed chance of heads.
  • Up to 2000 flips.

Questions about this tool

Is 3 heads in a row within 10 flips rare?

No, the chance is about 50.8%, roughly every other try.

How many flips does 5 heads in a row take on average?

With a fair coin the average is 2^(k+1) - 2 = 62 flips.

What is the difference between heads only and either side?

Either side counts k identical faces in a row, heads or tails, so the chance is higher.