What this is
A coin flip simulator that uses real cryptographic randomness, not the pseudo-random Math.random that ships in most browser tools. Pick “1 flip” for a quick decision or batch up to 1,000 flips when you want to see actual probability behavior in action.
The animation on single flips is purely cosmetic, under the hood, every flip uses the Web Crypto API’s getRandomValues to pull a real random byte and decides heads/tails based on whether it’s above or below 128. That’s as truly random as you can get in a browser without quantum hardware.
Why use it instead of an actual coin
Three real reasons:
- You don’t have a coin handy. Most people don’t carry coins anymore. Phones do.
- You want to flip a lot. No one’s flipping 100 times by hand. The 1,000-flip batch finishes instantly and shows the running heads/tails ratio.
- You want to see streaks. With 100+ flips, the longest-run statistic almost always surprises people. Runs of 7 or 8 same-side flips are common, they feel “rigged” but they’re statistically expected. With 1,000 flips, runs of 10+ are normal.
The history strip at the bottom shows your last 200 flips colored by side. It’s visually obvious how chunky the distribution actually is, even when the heads-percentage hovers near 50%.
What “fair” actually looks like
A common intuition: if you flip 100 times, you should get 50 heads. The actual distribution: somewhere between 40 and 60 heads happens about 95% of the time. Less than 40 or more than 60 happens the remaining 5% of the time. The further from 50% you are, the more flips it takes to converge.
After 10 flips, the ratio can easily sit at 70/30, the simulator’s recent-history view will show it clearly. After 100, expect 45-55. After 1,000, expect 48-52. After 10,000, expect 49.5-50.5. Convergence is real but slow.
Use cases people actually have
- Decision making: heads = option A, tails = option B. The classic.
- Sports betting demos: flipping repeatedly to demonstrate that “hot streaks” exist by chance, not because of momentum.
- Class assignments: probability homework that wants you to “flip a coin 100 times and report the results.” This is faster than doing it physically.
- Tabletop games: when you don’t have a coin but the rules call for one.
- Programming education: demonstrating the difference between Math.random and getRandomValues.
Differences from real coin flips
A real physical coin flip isn’t perfectly 50/50, research from Stanford suggests coins are about 51% likely to land on the same side they started on, due to physical biases in the flipping motion. This simulator is mathematically 50/50 because the underlying random number generator is uniform. So it’s actually more random than a real coin in a strict statistical sense.
The “longest run” stat tracks streaks across your entire session. If you reset, the count starts over. Expected longest runs grow logarithmically with sample size, about log₂(N), so 1,000 flips should expect a longest run of around 10.
Frequently asked questions
Why does crypto.getRandomValues matter? Math.random is pseudo-random, predictable if you know the seed, biased in subtle ways, and not suitable for cryptography or fair gambling. getRandomValues taps into the operating system’s secure random pool, which is unpredictable even to attackers. For a coin flip, the difference doesn’t matter much, but it costs nothing to use the better source.
Can I save my flip history? Not currently, closing the tab clears the history. For research purposes, copy the last 200 flips from the strip before navigating away.
Is this rigged toward one side? No. The simulator decides heads/tails based on whether a uniform random byte is ≥128 or <128. Half the byte space is on each side. Run 10,000 flips and check, the ratio will be within a fraction of a percent of 50/50.
What’s the difference between this and a “yes/no” tool? Pure semantics. A coin flip is binary; a yes/no decision is binary. Same underlying math. Pick whichever feels right for your decision.