Coin Flip Calculator
How the simulator flips
Each flip asks the browser for random bytes from crypto.getRandomValues — the operating system’s cryptographic random source, the same one that keys secure connections — and reads one bit per coin. That matters more than it sounds: the pseudorandom generator behind most quick simulations (Math.random) is fine for games but is a deterministic sequence under the hood, while the cryptographic source is seeded from system entropy and is not reproducible. A fair coin is then just a fair bit: heads on 0, tails on 1, no weighting anywhere. Flip 1,000 coins and you will almost never see exactly 500 heads — expect to land within about ±32 of it (one standard deviation is √(1000)/2 ≈ 15.8, so two of them is ≈ 32) — and a run that lands exactly on 500 every time would be the suspicious one.
The streaks are the part intuition gets wrong. In 100 fair flips, the longest run of heads is typically around 6 or 7 — a run of 7 heads in a row feels like the coin is “hot” or rigged, yet in a long session it is not just likely, it is expected: there are 94 different windows where such a run could start. Gamblers call the belief that tails is “due” after a run of heads the gambler’s fallacy; the coin has no memory, and each flip starts again at exactly 50/50 whatever the last twenty did. The simulator shows the longest heads and tails runs in your batch so you can watch ordinary randomness produce “patterns” on demand.
The probability panel
Exact probabilities come from the binomial distribution: the chance of exactly k heads in n flips is C(n, k) / 2ⁿ, where C(n, k) counts the sequences containing exactly k heads. Exactly 5 heads in 10 flips is C(10, 5)/1024 = 252/1024 = 24.61% — the single most likely count, and still less than one chance in four, which surprises people every time. “At least” questions add the tail: 7 or more heads in 10 flips is (120 + 45 + 10 + 1)/1024 = 17.19%. The panel computes exactly k, at least k, and at most k for any n up to 1,000, using logarithms to keep the arithmetic stable at the big end (1000! is not a number your calculator wants to meet directly). This is the mathematics under every “best of” series, quality-control sampling plan and A/B test you will ever meet — the coin is just its purest form.
A worked example
Ten flips, and you want at least 7 heads. The favourable sequences: exactly 7 heads can be arranged C(10, 7) = 120 ways, exactly 8 in 45 ways, exactly 9 in 10 ways, exactly 10 in 1 way — 176 sequences out of 2¹⁰ = 1,024 equally likely ones, so the probability is 176/1024 = 17.19%. The mirror question — at most 3 heads — is the same 17.19% by symmetry. And the single likeliest outcome, exactly 5, is 24.61%: bet on “about half” in the long run, but never on exactly half in a short one. All three figures come out of the panel below if you enter n = 10, k = 7 (and then k = 5).
Frequently asked questions
What are the odds of getting 7 heads in a row?
For seven specified flips, (1/2)⁷ = 1/128 ≈ 0.78%. But that is the answer to a stricter question than the one people usually mean. In a run of 100 flips there are 94 places a 7-run could start, and the chance of at least one run of 7 or more heads somewhere in 100 flips is over 50% — long streaks are a normal feature of randomness, not evidence of a rigged coin. The panel’s “at least k in n” answers the batch question; the streak appears in the simulator’s run report.
Is the coin in this simulator really fair?
Yes. Each flip reads one bit from crypto.getRandomValues, the browser’s interface to the operating system’s cryptographic random generator, which is seeded from system entropy and designed to be unpredictable. There is no weighting, no memory and no adjustment toward 50/50 — a batch can land 60/40 and the next one can too. Over very large numbers the heads share will settle near 50%, not because the tool corrects it, but because that is what independent fair flips do.
Why is exactly 5 heads in 10 flips not a 50% chance?
Because 5 is one count among eleven possible counts (0 through 10), and the probability is spread across all of them. Exactly 5 heads covers C(10, 5) = 252 of the 1,024 equally likely sequences — 24.61%. The neighbouring counts take the rest: 4 and 6 heads take about 20.5% each, 3 and 7 about 11.7% each, and so on down to 0 and 10 at about 0.1% each. “About half” is highly likely; “exactly half” is merely the single most likely outcome.
What is the gambler’s fallacy?
The belief that a run of one outcome makes the opposite outcome more likely next — that after six heads, tails is “due”. For independent events it is false: the coin has no memory, and the probability of heads on the next flip is 50% whatever came before. The confusion comes from a true statement about long runs — the proportion of heads settles toward 50% — being misread as the coin correcting itself. It does not correct; it dilutes. Six extra heads in the first six flips are simply swamped, not repaid, by the thousands that follow.
How many flips until heads and tails are “equal”?
In proportion, quickly; in count, possibly never. The law of large numbers says the share of heads converges toward 50% — after 10,000 flips, being outside 49–51% would be a surprise. But the difference between the counts does not converge to zero; it typically wanders further from zero in absolute terms (on the order of the square root of the number of flips) while shrinking as a percentage. Expect the gap to be a few dozen after 10,000 flips — and to be 0.5% of the total, which is the sense in which the coin is fair.
Related tools
Binomial probabilities as in standard probability texts, checked on 24 November 2026. Everything is calculated in your browser — nothing you type is sent anywhere.