The math of a single coin flip
A fair coin has two outcomes, and no reason to prefer either one. That symmetry is the entire foundation: the probability of heads is 1/2, the probability of tails is 1/2, and together they account for 100% of what can happen. Probability theory calls this a Bernoulli trial — a single experiment with two results — and the coin flip is its mascot because the odds are perfectly even and the outcome is impossible to argue with.
The second pillar is independence. Flip number eleven has no idea what flips one through ten did. The coin carries no memory, owes no debts and keeps no score. This sounds obvious stated flatly, yet it is the single most violated intuition in gambling, investing and everyday superstition. After five heads in a row, the sixth flip is still exactly 50/50 — not 'due' for tails, not 'hot' for heads, just 50/50, the same as every flip before it.
Those two facts — equal odds, independent trials — generate everything else on this page. Streak tables, binomial distributions, fairness tests and Monte Carlo simulations are all just arithmetic applied to those two assumptions. If you remember nothing else, remember this: 50/50 per flip, and the past never leaks into the future.
Odds of consecutive heads: the streak table
Because flips are independent, probabilities multiply. Two heads in a row means hitting a 1/2 chance twice: 1/2 × 1/2 = 1/4. Three in a row is 1/8. The pattern is (1/2)^n, and it decays fast — every additional flip doubles the difficulty. Here is the full reference table for a run of heads starting from your next flip:
| Heads in a row | Probability | About 1 in |
|---|---|---|
| 1 | 1/2 (50%) | 2 |
| 2 | 1/4 (25%) | 4 |
| 3 | 1/8 (12.5%) | 8 |
| 4 | 1/16 (6.25%) | 16 |
| 5 | 1/32 (3.1%) | 32 |
| 6 | 1/64 (1.6%) | 64 |
| 7 | 1/128 (0.78%) | 128 |
| 8 | 1/256 (0.39%) | 256 |
| 9 | 1/512 (0.20%) | 512 |
| 10 | 1/1024 (0.098%) | 1,024 |
Two things are worth noticing. First, the numbers get dramatic quickly: ten straight heads is a one-in-a-thousand event before you start, which is why it feels impossible when it happens to you. Second, 'before you start' is doing heavy lifting in that sentence. If you have already flipped nine heads, the probability of reaching ten is not 1/1,024 — it is 1/2, because the first nine are already in the bank. The table describes futures, not pasts. Once a streak exists, every step of extending it is a fresh coin toss.
How long until you see a streak? Waiting times
The streak table tells you the odds of a run starting on a specific flip. A different question — and the one people actually ask — is how long you have to wait before a run of n heads shows up at all. The answer comes from a branch of probability called renewal theory, and for a fair coin the expected wait for a run of n heads is 2^(n+1) − 2 flips. Two in a row takes about six flips on average, three takes fourteen, five takes sixty-two, and the ten-head monster from the table above shows up on average only after 2,046 flips.
Averages hide the interesting part, though. Waiting times are wildly lumpy. In 100 flips you have about an 80% chance of seeing at least one run of six heads somewhere — a streak the table calls a one-in-64 event per position — and yet there is also a real chance of flipping 100 times and never once seeing even four heads in a row. Both experiences feel contradictory and both are completely ordinary. The one-in-64 figure describes any particular window; with 95 overlapping windows in 100 flips, the run has many chances to fire.
This is also why betting systems that chase streaks fail. If you wait for five heads and then bet on tails, your expected wait was 62 flips of watching for nothing, and the payout on the sixth flip is still 1/1. The waiting time is real, but it buys no information about the outcome.
Conditional probability: when partial information matters
Conditional probability answers questions of the form 'given that X happened, what is the chance of Y?' It is written P(Y|X), and coin flips make it concrete. Suppose you flip two coins. The chance both are heads is 1/4. Now suppose a friend peeks and tells you at least one coin is heads. That information eliminates the tails-tails outcome, leaving three equally likely cases — heads-heads, heads-tails, tails-heads — so the chance both are heads climbs from 1/4 to 1/3. Nothing about the coins changed; your knowledge did, and the math follows knowledge.
Here is the subtle part that trips people up. If your friend instead says 'the first coin is heads', the answer drops back to 1/2, because now only two cases remain: heads-heads and heads-tails. 'At least one' and 'this specific one' are different information, and they give different answers. This is why conditional probability questions feel like riddles — the wording is the problem, not the arithmetic.
What conditional probability never does is reach backward through independence. Knowing the last ten flips were heads tells you something about whether the coin might be rigged, but it tells you nothing about the next flip of a fair coin. Information about outcomes updates your beliefs about the coin; it never updates the coin itself.
Monte Carlo intuition: fake it till you measure it
Some probability questions have tidy formulas. Many do not. What is the chance that 100 flips contain a run of at least seven heads somewhere? Doing that by hand is a pain. Doing it by simulation is five lines of code: flip 100 coins, check for a run of seven, repeat the whole thing 100,000 times, and count how often it happened. That is Monte Carlo — named after the casino — and its entire philosophy is 'when the math is hard, just run the experiment a ridiculous number of times and watch the answer emerge.'
The simulator at the top of this page is a tiny Monte Carlo machine. Click it once and you get a single sample — meaningless on its own. Click it twenty times and a shape appears: most batches land between 45 and 55 heads, a few stray to 42 or 58, and the occasional oddball breaks 60. You have just estimated a distribution by brute force, which is exactly what quantitative analysts and physicists do with bigger computers.
The catch is that Monte Carlo needs volume: accuracy improves only with the square root of the number of runs, so quadrupling the simulation count merely halves the error — the same square-root law that governs every coin flip statistic on this page.
How to test whether a coin is fair
The fairness test is conceptually simple: flip the coin many times and compare the split to 50/50. The execution is where everyone goes wrong, because small samples lie. Flip a fair coin ten times and it lands 7–3 about one time in four. If you declared the coin rigged every time you saw 7–3, you would be convicting innocent coins on a daily basis. Ten flips cannot convict anyone of anything.
Statistics formalizes the intuition with the binomial distribution. In n flips of a fair coin, the heads count wobbles around n/2 with a standard deviation of √n/2. At 100 flips that is 5, so most results land between 45 and 55, and 40–60 covers about 95% of all runs. At 1,000 flips the standard deviation is about 16, and roughly 95% of runs land between 468 and 532 — a much tighter band in percentage terms. This is the law of large numbers in working clothes: the absolute wobble grows, but the percentage wobble shrinks.
A practical rule: to accuse a coin of bias with any confidence, the observed split needs to sit more than two standard deviations from 50%. That means catching a 55%-heads coin takes a few hundred flips, and catching the famous 51% physical bias takes on the order of 10,000. If a friend shows you a coin that 'always comes up heads' after twelve flips, the correct response is to ask for twelve hundred.
Weighted coins: probability with a thumb on the scale
A weighted coin breaks the first assumption of this page — equal odds — while keeping the second, independence. If a coin lands heads 70% of the time, every flip is still its own event, but now the arithmetic shifts: two heads in a row is 0.7 × 0.7 = 49%, not 25%, and a run of five heads is a 17% event instead of a 3% one. Streaks that would be shocking on a fair coin become routine, which is precisely how casinos, auditors and paranoid card players sniff out loaded randomness: the texture of the results stops matching the fair-coin tables.
The instructive part is how hard bias is to see in small samples. Flip a 70% coin ten times and an 8–2 split for heads is unremarkable — a fair coin produces the same split one time in nine. The bias only becomes undeniable as the count grows. If you want to feel this yourself, our weighted coin simulator lets you drag the heads probability anywhere from 0% to 100% and watch how many flips it takes before the imbalance stops hiding in the noise.
Weighted-coin math also explains a real-world trap: small A/B tests. A landing page that converts 7 of 10 visitors looks like a winner, but so does a fair coin that happens to land 7 heads. Until the sample is big enough to separate the bias from the bounce, the honest reading of any lopsided small sample is 'interesting, keep flipping.'
The physics of a real coin flip
Everything on this page assumes a fair coin, and physics has a footnote for that assumption. In 2007, Persi Diaconis — a Stanford statistician and former professional magician — modeled the mechanics of a flipped coin and found that it precesses like a gyroscope in flight, giving the side that started facing up about a 51% chance of landing up. One percentage point: invisible to any human, but mathematically real.
The physical world offers more quirks. A coin caught in the hand carries the starting-side bias; a coin bounced off a hard floor scrambles it, which is why the bounce is technically fairer than the catch. An American nickel can land on its edge roughly once in 6,000 tosses. Coins spun on a table rather than flipped drift measurably toward the lighter face. None of these effects matter for choosing a restaurant, but all of them are reasons serious lotteries use tumbling machines instead of coins.
The coin has been humanity's tiebreaker for three thousand years precisely because these biases are small enough to ignore — you can read the full story on our history of the coin flip page. A browser-based flip goes one better: cryptographic randomness has no thumb, no gyroscope and no starting side, so the 50/50 on this page is exact in a way no physical coin can match.
The gambler's fallacy and other ways people misread coins
On August 18, 1913, at the Monte Carlo casino, a roulette wheel landed on black twenty-six times in a row. Gamblers lost millions betting on red along the way, increasingly certain that red was 'due'. The wheel, being a wheel, did not care. This is the gambler's fallacy in its natural habitat: the belief that independent random events somehow balance out in the short run, so a streak creates pressure for the opposite outcome.
The coin-flip version sounds like this: 'Five heads in a row — tails is bound to come.' No. The probability of tails on flip six is 1/2, identical to what it was on flip one. What people are actually feeling is a true fact misapplied: in a thousand flips the split does converge toward 50/50, but it converges by dilution, not by compensation. The coin never catches up; the early streak just gets absorbed into a bigger sample until it no longer matters.
Two cousins of the fallacy are worth naming. The hot hand fallacy runs the other direction — believing a streak means the streak will continue, as if the coin were 'hot'. And the clustering illusion is the habit of seeing meaning in the lumps that randomness naturally produces: runs of four or five heads are not anomalies in 100 flips, they are expected several times over. Randomness looks streakier than intuition expects, which is why real random sequences are constantly accused of being rigged by the humans watching them.
The coin flip next to other chance machines
The coin flip earns its place as the default randomizer by being the worst-case simple: two outcomes, perfectly balanced, zero equipment. It is worth setting that next to the other everyday chance machines to see how the odds stack up. Every number below is exact — no rounding tricks — and each machine keeps the same independence property the coin has, which is why the same fallacies follow people from coins to cards to roulette wheels.
| Randomizer | Target outcome | Probability |
|---|---|---|
| Fair coin | Heads | 1/2 — 50% |
| Six-sided die | Rolling a six | 1/6 — about 16.7% |
| Standard 52-card deck | Drawing any ace | 4/52 — about 7.7% |
| Two dice | Rolling a seven | 6/36 — about 16.7% |
| American roulette | A specific number | 1/38 — about 2.6% |
| American roulette | Red (18 of 38 slots) | 18/38 — about 47.4% |
The most important number in the table is roulette's red at 47.4% — the coin's nearest cousin, except the two green slots carve out a permanent house edge of about 5.3%. A coin flip is the same bet with the casino removed. Counting outcomes rather than trusting gut feel is the whole skill, and it is exactly the counting you practice on the binomial problems higher up this page.
Teaching probability with coin flips
Coin flips are the standard classroom gateway to probability because the equipment costs nothing and every misconception shows up within ten minutes. A classic exercise: have each student flip ten times and write the split on the board. With 28 students, you will typically see about seven land exactly 5–5, eleven or twelve land 6–4 or 4–6, half a dozen land 7–3, and two or three land 8–2 or wider. The class has just drawn a binomial distribution with their own hands, and the students holding 8–2 results get to feel — rather than be told — why a small sample cannot convict a coin.
The follow-up exercise targets the gambler's fallacy directly. Ask students to write down a fake sequence of twenty coin flips from imagination, then compare it with twenty real flips. The invented sequences alternate too politely and avoid long runs; the real ones contain streaks of four or five that students swear they would have been suspicious of. The gap between what randomness looks like and what people think it looks like is the entire lesson, and it takes one class period.
Online simulators compress the tedium: project a hundred-flip batch, then a thousand, and let the class watch the percentage bar crawl toward 50% — the law of large numbers in the time it used to take to distribute actual coins.
Simulating coin flips in code
A coin flip in code is one line: draw a random number between 0 and 1 and call it heads if it lands under 0.5. Everything else — streaks, distributions, Monte Carlo estimates — is a loop around that line. Here is a complete Python example that runs a 100-flip experiment 10,000 times and checks how often the split strays outside 40–60:
import random
def batch(n=100):
return sum(random.random() < 0.5 for _ in range(n))
runs = [batch() for _ in range(10_000)]
outside = sum(not 40 <= h <= 60 for h in runs)
print(outside / len(runs)) # ≈ 0.036 — about 1 run in 28Run it and you will get a number near 3.6%, close to the theoretical value the binomial distribution predicts — simulation and formula agreeing is the whole Monte Carlo story. Change the 0.5 to 0.7 and you have a weighted coin; wrap the batch in a streak counter and you can verify the claim elsewhere on this page that runs of six or seven are ordinary in 100 flips.
The same idea in JavaScript is what powers this site: crypto.getRandomValues() supplies the random bits — the same class of randomness used for security tokens, and a stricter standard than the Math.random() you would reach for in a quick script. For teaching and decision-making, browser randomness is more than fair enough.