Statistics
Coin flipper
Flip a fair coin, or many at once. Choose how many coins, press Flip, and see the sequence, the count of heads and tails, and how far the result sits from an even split.
1 to 100,000. Press Flip again for a new toss.
Show the working, step by step
What to expect from n flips
The number of heads in n flips of a fair coin follows a binomial distribution with p = ½. Its average and spread are:
expected heads = n ÷ 2 SD = √(n × ½ × ½) = √n ÷ 2
The calculator reports how far your count landed from n ÷ 2 in standard deviations (a z-score), and the exact probability that a fair coin gives a split at least that far from even, in either direction. That probability is the two-sided p-value of a binomial test for a fair coin.
A worked example
The default flips 10 coins, so you should expect 5 heads with a standard deviation of √10 ÷ 2 = 1.58. Suppose a toss comes up with 8 heads and 2 tails.
z = (8 − 5) ÷ 1.58 = 1.90
A split of 8–2 or more extreme means 8, 9 or 10 heads, or 8, 9 or 10 tails. Counting the sequences: C(10, 8) + C(10, 9) + C(10, 10) = 45 + 10 + 1 = 56 on each side, out of 2¹⁰ = 1,024.
P(split at least as uneven as 8–2) = 2 × 56 ÷ 1024 = 0.109
So about one toss of 10 coins in nine is at least this lopsided. That is ordinary luck, not evidence of a trick coin. Press Flip a few times and you will see splits like this turn up.
How to read the result
Small numbers of flips swing a long way. With 10 coins, anything from 2 to 8 heads is well within normal variation. The percentage of heads settles as the number of flips grows, because the standard deviation of the proportion is 0.5 ÷ √n: about 16 percentage points for 10 flips, 5 points for 100 and half a point for 10,000. The raw count, on the other hand, wanders further from n ÷ 2 as n grows, since its standard deviation is √n ÷ 2.
The longest run is often longer than people guess. In 100 fair flips the longest run of the same face is usually 6 or 7, and a run of 5 heads somewhere in the sequence is more likely than not. The coin toss streak calculator gives the exact figures.
Common mistakes
- Expecting perfect alternation. Real random sequences have more long runs than hand-made “random” ones. A sequence with no run longer than 3 in 100 flips would be suspicious.
- Treating a 7–3 split as proof of bias. It needs many more flips before a small bias stands out from chance.
- Thinking tails is due after a run of heads. Each flip is independent of the last.
To work out exact probabilities rather than flip, use the coin flip probability calculator, which gives the chance of exactly, at least or at most k heads.
Common questions
Is this coin flipper really random?
Each flip comes from your browser's cryptographic random number generator
(crypto.getRandomValues), the same source used to make encryption keys. Heads and
tails each have probability exactly ½, and every flip is independent of the ones before it.
Nothing is sent to a server and no result is stored.
I got 7 heads in 10 flips. Is the coin biased?
No. With a fair coin, a split of 7–3 or more lopsided (either way) happens with probability 2 × 176/1024 = 0.344, about one time in three. You need far more flips before a small bias would show. With 1,000 flips, 550 heads or more would be unusual: that is more than 3 standard deviations above 500.
After five heads in a row, is tails due?
No. The coin has no memory, so the next flip is still 50–50. Believing otherwise is the gambler's fallacy. The share of heads does drift toward 50% over many flips, but that happens because later flips dilute an early run, not because tails catches up.
How many heads should I expect?
Half the flips, give or take √n ÷ 2. For 10 coins that is 5 ± 1.58, for 100 coins 50 ± 5, and for 10,000 coins 5,000 ± 50. About 95% of tosses land within two of those standard deviations of the expected count.
Can I use this to settle a decision?
Yes. Set the number of coins to 1 and press Flip. Agree before you flip which side means what.
Related calculators
-
Coin flip probability
The exact chance of k heads in n flips, with a biased coin if you like.
-
Coin toss streak calculator
How likely a run of 5 or 10 heads in a row is.
-
Binomial distribution
The distribution behind every count of heads.