Skip to content

Coin Flip Probability Calculator and Simulator

Chances of k heads in n flips, of a streak of heads, expected flips to get one, plus a seeded coin flip simulator.

Your details

Question

50 % for a fair coin. Change it to model a biased coin.

%

Results update as you type

P(exactly k heads)

0.246094 (24.61%)

P(at least k heads)
0.623047 (62.3%)
P(at most k heads)
0.623047 (62.3%)
Expected number of heads
5

Step-by-step solution
  1. P(X = 5) = C(10, 5) × 0.5^5 × 0.5^5 = 0.24609375
  2. P(X ≥ 5) = Σ P(X = i), i = 5…10 = 0.62304688
  3. P(X ≤ 5) = Σ P(X = i), i = 0…5 = 0.62304688

A coin toss is the simplest experiment in probability: two outcomes, heads or tails, each with a 50 % chance on a fair coin. Yet it raises surprisingly rich questions. What are the chances of exactly 5 heads in 10 flips? Of at least 8? How likely is a streak of 5 heads in a row somewhere in 20 tosses? And on average, how many flips does it take to see three heads in a row?

This coin flip calculator answers all of these exactly, in three modes:

  • Number of heads — the binomial probability of exactly, at least and at most kk heads in nn flips, with a chart of every possible count.
  • Streaks — the probability of at least one run of rr heads (or of rr identical faces) in nn flips, computed exactly rather than simulated, plus the expected number of flips until the streak first appears.
  • Flip coins — a virtual coin that tosses up to 1,000 times, shows every result, the totals, the longest streak and how the share of heads settles towards 50 %.

You can also set a different probability of heads to model a biased coin. The tool is for learning, classroom work and settling friendly arguments — it is not a gambling aid: no strategy changes the odds of a fair coin.

How to use this calculator

  1. Pick the question: number of heads, streaks, or flip coins.
  2. For number of heads, enter the number of flips nn and the number of heads kk. Read the probability of exactly, at least and at most kk heads.
  3. For streaks, enter the number of flips and the streak length, and choose whether only heads count or a run of either face. Read the probability and the expected waiting time.
  4. For flip coins, enter how many flips you want and a seed. Change the seed for a new series; the same seed always reproduces the same flips.
  5. Leave the probability of heads at 50 % for a fair coin, or change it for a biased one.

The formula

Number of heads. With nn independent flips and probability pp of heads, the number of heads XX follows a binomial distribution:

P(X=k)=(nk)pk(1−p)n−kP(X = k) = \binom{n}{k} p^k (1-p)^{n-k}

"At least kk" adds the terms from kk to nn; "at most kk" adds them from 0 to kk. The expected number of heads is npnp.

Streaks. Track the length of the current run of heads after each flip (0, 1, …, r−1r-1). A head extends the run with probability pp; a tail resets it to 0. Summing the probability of reaching length rr over nn steps gives the exact chance of at least one streak. For a fair coin, the number of sequences without rr heads in a row follows a generalised Fibonacci recurrence.

Expected flips. The mean number of flips until the first run of rr heads is

E=1−prpr(1−p)⇒E=2r+1−2 for a fair coin.E = \frac{1 - p^r}{p^r (1-p)} \quad\Rightarrow\quad E = 2^{r+1} - 2 \text{ for a fair coin.}

For a run of either face on a fair coin, it is 2r−12^r - 1.

Worked example

Exactly 5 heads in 10 flips: (105)/210=252/1024=0.2461\binom{10}{5} / 2^{10} = 252 / 1024 = 0.2461, so 24.61 %. At least 8 heads: (45+10+1)/1024=0.0547(45 + 10 + 1)/1024 = 0.0547 (5.47 %).

Three heads in a row within 10 flips: 0.5078 (50.78 %) — slightly better than even. Five heads in a row within 20 flips: 0.2499, about 24.99 %, or one chance in four. A run of five identical faces, heads or tails, in 20 flips: 0.4584 (45.84 %).

Waiting time: on average 14 flips to see three heads in a row (24−22^4 - 2) and 62 flips for five; three identical faces of either kind take 7 flips on average.

Simulation: 100 flips with seed 2026 give 47 heads and 53 tails, with a longest streak of 5.

Streaks are more common than intuition says

Most people underestimate how often long runs appear in random sequences. In 100 fair flips, the longest run of the same face is most often 6, 7 or 8, and a run of at least 5 heads in a row happens in roughly 4 out of 5 series. When students are asked to invent a "random" sequence, they switch sides too often and almost never write long runs — a classic way for teachers to spot made-up data. Use the Streaks mode with 100 flips to check it.

The gambler’s fallacy

After five heads in a row, the next flip is still 50/50: the coin has no memory. Long-run balance does not come from tails "catching up" but from the early streak being diluted by many later flips. That is why the share of heads in the simulation drifts towards 50 % while the gap between heads and tails, in absolute numbers, can stay large. For the full binomial toolbox, see the binomial distribution calculator; for dice, the dice probability calculator.

Frequently asked questions

What is the probability of getting heads 5 times in a row?

If you flip exactly five times, it is (1/2)⁵ = 1/32, about 3.1 %. Within a longer series it is much higher: in 20 flips, the chance of at least one run of 5 heads is about 25 %. The Streaks mode computes it exactly for any length.

How many flips does it take to get 3 heads in a row?

On average 14, given by the formula 2^(r+1) − 2 with r = 3. The actual number varies a lot: sometimes three flips are enough, sometimes it takes more than 40.

Is a coin flip really 50/50?

Very nearly. Studies of real tosses have found a slight tendency to land on the side that started face up, of the order of 51 %. For practical purposes, and in this calculator by default, a fair coin is 50/50.

Can I use the simulator to make a decision?

Yes, flip once to choose between two options. Write down the seed beforehand if someone else needs to check the result. The flips are pseudo-random and reproducible, not suitable for security or betting.

Does a streak of tails make heads more likely?

No. Each flip is independent; the probability stays the same whatever happened before. Believing otherwise is the gambler’s fallacy.

Sources

Last updated:

More Statistics calculators

People also use