Coin Flip, Explained
After reading this you can predict how many heads to expect in any number of flips, judge whether a streak is suspicious, and stop believing that a coin is ever "due" to land the other way.
What a coin flip actually models
A coin flip is the simplest random experiment: two outcomes, each with probability 0.5, and no memory. Flip a fair coin ten times and get heads every time. The eleventh flip is still exactly 50/50. The coin does not know its history.
The tool draws each flip from your browser's cryptographic random source, so the sequence is not something you could predict from earlier flips. That matters because most "random" numbers in software come from formulas that repeat if you know the seed. A crypto source does not give you that shortcut.
Here is the hook. Flip a coin 100 times and there is roughly a 97% chance you will see a run of 5 or more identical results in a row. People read that run as a sign the coin is loaded. It is not. Long streaks are what fairness looks like at scale.
When to use it, and when not
Use a coin flip when you have exactly two options and want an unbiased, defensible choice: who goes first, which of two restaurants, tails means you skip the errand. Use the batch mode (up to 10,000 flips) when you want to see probability behave over many trials rather than settle one decision.
Do not use a coin flip to pick from three or more options. Folding "best of three" flips onto three choices skews the odds. For several named options, spin the Wheel Spinner instead, where each entry gets an equal slice. If you need weighted outcomes or dice-style totals, the Dice Roller handles those directly.
Never use a coin flip, or any of these tools, to generate secrets like passwords or keys. They are built to be reproducible and fun to watch, not to resist an attacker studying your output. Use a dedicated password or key generator for anything that must stay secret.
The math: the binomial distribution
Count the heads in n flips and you have a random number that follows the binomial distribution. The probability of getting exactly k heads is:
Here n is the number of flips, k is the number of heads you are asking about, and p = 0.5 is the chance of heads on one flip. The term \binom{n}{k} counts how many different orderings give k heads. For a fair coin p = 1-p = 0.5, so the formula simplifies, but the shape stays the same.
Two numbers describe the whole distribution. The expected number of heads is the mean:
The typical spread around that mean is the standard deviation:
For 100 flips, \mu = 100 \times 0.5 = 50 and \sigma = \sqrt{100 \times 0.5 \times 0.5} = 5. So most runs of 100 land between 45 and 55 heads. The key intuition: the mean grows in proportion to n, but the spread grows only with \sqrt{n}. That is why the percentage of heads settles down as you flip more.
Why the percentage settles but the count wanders
People confuse two different things. The percentage of heads gets closer to 50% as you flip more. The count of heads minus tails usually gets further from zero. Both are true at once.
Look at the ratio of spread to mean. At 100 flips the spread is 5 heads, which is 5% of the count. At 10,000 flips the spread is \sqrt{10000 \times 0.25} = 50 heads, only 0.5% of the count. The percentage tightens by a factor of 10, exactly as \sqrt{n} predicts. But 50 heads of raw imbalance is larger than 5.
A worked example with the default 100 flips
Reading 100 flips
Run the demo, which flips 100 times. Suppose the tool reports 54 heads and 46 tails, with a longest streak of 6. Here is how to check whether that is normal.
- Expected heads: \mu = 100 \times 0.5 = 50.
- Standard deviation: \sigma = \sqrt{100 \times 0.25} = 5.
- Your result of 54 heads is (54 - 50) / 5 = 0.8 standard deviations above the mean. Anything within about 2 standard deviations (40 to 60 heads) is unremarkable.
- Longest streak: in 100 flips the expected longest run is close to 6, and a run of 5 or more appears about 97% of the time. A streak of 6 is exactly what you should expect, not a red flag.
So 54/46 with a streak of 6 is a textbook fair result. You would need something like 68 heads (over 3 standard deviations out) before a single run of 100 raised a real eyebrow.
Explore how sample size changes the picture
Reading and interpreting your results
The tool gives you three numbers: the tally, the percentages, and the longest streak. Read them together.
- Tally
- The raw counts of heads and tails. Compare the difference to 2\sigma = 2\sqrt{0.25n}. For 1,000 flips that is about 32, so a gap of 480 versus 520 is normal.
- Percentage
- Heads as a share of all flips. Judge it against 50% plus or minus 2\sigma_{\%}. For 1,000 flips that band is 50% plus or minus about 3.2 points.
- Longest streak
- The longest unbroken run of one face. The expected longest run in
nflips is roughly \log_2(n). For 1,000 flips that is about 10, so a run of 9 or 11 is ordinary.
Common mistakes
The most frequent error is the gambler's fallacy: believing tails is "due" after a run of heads. Each flip is independent, so the chance stays 0.5 no matter what came before. After five heads, the chance of a sixth head is still 50%, not lower.
The mirror error is the hot-hand belief that a streak will continue. It will not, and it will not reverse either. The coin has no state.
A third mistake is treating a large raw gap as bias. In 10,000 flips a gap of 100 heads sounds huge but is only 100 / 50 = 2 standard deviations, which happens for about 1 run in 20. Convert to standard deviations before judging.
Quick check for any batch: divide the head-minus-tail gap by \sqrt{n}. If the result is under 2, the run is unremarkable. Between 2 and 3 is mildly unusual. Over 3 is worth a second look, though even that happens about 1 time in 370.
Related tools
For more than two options, spin the Wheel Spinner, where each entry you type gets an equal share. For totals, modifiers or keep-highest rules, the Dice Roller supports standard notation like 3d6+2 and reports its own statistics.
Frequently asked questions
Is the coin flip truly random?
Each flip is an independent 50/50 draw from your browser's cryptographic random source. You cannot predict the next flip from earlier ones. It is random enough for any decision, but not intended for cryptographic secrets.
Why did I get 8 heads in a row?
Because long streaks are normal. In 100 flips a run of 5 or more appears about 97% of the time, and a run of 8 shows up in a meaningful fraction of longer batches. A streak is not evidence of a broken coin.
After many heads, is tails more likely?
No. That is the gambler's fallacy. The coin has no memory, so the next flip is still exactly 50/50 regardless of the last twenty results.
How many flips do I need to see 50%?
The more you flip, the tighter the percentage. At 100 flips a typical run lands within 5 points of 50%; at 10,000 flips within 0.5 points. It never locks exactly on 50%, it just narrows.
Does my data leave the browser?
No. Everything runs locally in your browser. Nothing you enter or generate is sent to any server.