Coin Flip Simulator
Flip a virtual coin with a satisfying animation. Run single flips or flip up to 100 coins at once. Track heads/tails statistics and streaks over time.
Flip Multiple Coins at Once
Statistics
What is a Coin Flip?
A coin flip (or coin toss) is one of the simplest random experiments in probability theory. A fair coin has two equally likely outcomes — heads or tails — each with a theoretical probability of exactly 0.5 (50%). This makes the coin flip the canonical example of a Bernoulli trial: a binary experiment with a fixed probability of success. The mathematics of coin flipping underpins much of classical probability theory, including the binomial distribution, the normal approximation, and the law of large numbers.
In practice, physical coin flips are not perfectly fair. Research by Stanford mathematician Persi Diaconis and colleagues found that coins are marginally more likely to land on the same side they started — approximately 51% vs 49% — due to the physics of angular momentum and the way humans flip coins. Coins also have slight mass asymmetries from manufacturing. These biases are negligibly small for most purposes, but they demonstrate that even the simplest physical systems deviate from the ideal theoretical model.
This virtual coin flip simulator uses your browser's pseudorandom number generator (Math.random()), which produces numbers uniformly distributed between 0 and 1. Values below 0.5 are heads; values 0.5 and above are tails — producing a precisely 50/50 distribution over a large number of flips. It is well-suited for decision-making, games, teaching probability concepts, and exploring the law of large numbers — the convergence of observed frequencies toward theoretical probabilities as sample size increases.
Probability Theory & the Law of Large Numbers
A fair coin has a 50% probability of landing heads and 50% tails on any single flip. However, in small samples you will often see streaks and imbalances — that is completely normal.
The Law of Large Numbers states that as the number of flips increases, the observed ratio of heads to tails will converge toward the theoretical 50/50. Try flipping 100 coins multiple times to see this in action — the ratio will get closer and closer to 50%.
How the Coin Flip Simulator Works
Formula, assumptions, and calculation steps for this dev tools tool.
Formula Used
Uses a pseudo-random number generator to produce a 50/50 binary outcome
Methodology
Generates a pseudo-random binary outcome with equal probability for heads or tails.
Calculation Steps
- Provide the input text or select generation options.
- Apply the selected encoding, parsing, hashing, or formatting rule.
- Validate the output where possible.
- Return copy-ready developer output.
Assumptions and Limits
- Generated or transformed output depends exactly on the supplied input.
- Security-sensitive values should be handled carefully.
- Browser tools do not replace production validation.
Frequently Asked Questions
A theoretical fair coin is exactly 50/50. In reality, physical coins have very slight manufacturing imperfections that can bias results by a fraction of a percent. Research by Diaconis et al. also found that a coin is slightly more likely to land on the same face it started on (~51%), due to the physics of the flip.
A streak is a consecutive sequence of the same result. In 10 coin flips, there is about a 50% chance of seeing a streak of 4 or more. In 100 flips, a streak of 7 is very likely. Long streaks feel improbable but are a normal feature of random sequences.
On average, you need about 2^11 - 2 = 2,046 flips to see 10 consecutive heads. The expected waiting time for a streak of n is (2^(n+1)) - 2 flips for a fair coin.
Yes. The simulator uses Math.random() which is a well-seeded pseudorandom generator in your browser — perfectly suitable for games, decision-making, and probability demonstrations. For security-critical randomness, use a cryptographic source.
Real-World Applications
Common Mistakes
Consecutive Heads Probability Reference
| Streak Length | Probability | 1 in N |
|---|---|---|
| 1 head | 50% | 1 in 2 |
| 2 in a row | 25% | 1 in 4 |
| 3 in a row | 12.5% | 1 in 8 |
| 5 in a row | 3.125% | 1 in 32 |
| 10 in a row | 0.098% | 1 in 1,024 |
| 20 in a row | 0.000095% | 1 in 1,048,576 |
References
- Diaconis, P., Holmes, S. & Montgomery, R. Dynamical Bias in the Coin Toss. SIAM Review, 2007.
- Feller, W. An Introduction to Probability Theory and Its Applications, Vol. 1, 3rd ed. Wiley, 1968.
- Kahneman, D. Thinking, Fast and Slow. Farrar, Straus and Giroux, 2011.
- National Institute of Standards and Technology. Random Number Generation. nist.gov.
- L'Ecuyer, P. Pseudorandom Number Generators. Wiley Encyclopedia of Computer Science and Engineering, 2009.
Related Calculators
Browse all Dev Tools calculators →Dice Roller
Roll any number and type of dice — d4, d6, d8, d10, d12, d20, and custom.
Random Picker
Pick random items from any list — names, options, or custom entries.
Probability Calculator
Calculate basic probability, combined events, and conditional probability.