This coin flip tool settles a decision with a fair heads or tails call, or runs a batch of flips so you can watch the odds play out over many trials. It is useful for making a quick choice, breaking a tie, teaching probability, or generating a random binary outcome — all without a physical coin.
How it works
Each flip reads a fresh random byte from the browser’s Web Crypto API and takes its lowest bit. A bit of 0 becomes Heads and 1 becomes Tails, giving a true 50/50 chance every time. Because the crypto source is unbiased, the result is fair and unpredictable. For a batch, the tool repeats this for each flip (up to 1,000) and tallies the totals.
Why Web Crypto instead of Math.random?
JavaScript’s Math.random() is a pseudo-random number generator (PRNG) — it produces a deterministic sequence from an internal seed. While adequate for games and animations, it is not suitable for security-sensitive or fairness-critical randomness because a determined observer could theoretically predict future outputs if they know the algorithm and state.
The Web Crypto API (crypto.getRandomValues()) is backed by the operating system’s cryptographically secure random source, which gathers entropy from hardware events (keystrokes, mouse movement, interrupt timing, etc.). This makes each bit genuinely unpredictable, which is why password generators, random ID generators, and this coin flip tool all prefer it.
Single flip vs. batch mode — when to use each
Single flip: Use when you need to make one decision. The result is instant and unambiguous — no room for “best of three” renegotiation that can creep in with physical coins.
Batch mode (multiple flips): Useful for:
- Demonstrating that 50/50 probability is real over many trials
- Generating a random binary sequence for a coding exercise or statistics demonstration
- Simulating repeated Bernoulli trials (each flip is independent with p=0.5)
- Assigning tasks randomly by flip outcome (heads = person A, tails = person B) across multiple items
Understanding probability in small samples
Ask for 10 flips and you might get something like:
H T T H H T H T T H — Heads: 6, Tails: 4
A 60/40 split in 10 flips is completely normal — in fact, getting exactly 5 heads and 5 tails in 10 flips happens less than 25% of the time by probability. The probability of getting at least 7 heads (or tails) in 10 flips is still around 17%, which is why small samples look uneven even with a perfectly fair coin.
Over 100 flips the split typically converges to something like 48–52% each way, and over 1,000 flips it lands very close to 50/50. This convergence is the law of large numbers — a useful concept to show students using the batch mode.
Common uses
- Decision making: “Heads I go to the gym, tails I don’t” — removes the mental bias that comes from secretly preferring one outcome.
- Fair assignment: Assigning which team goes first, who picks a topic, or who takes the first shift.
- Probability teaching: Show students that 3 heads in a row is normal and not evidence that tails is “due.”
- Game design and testing: Simulate coin-flip mechanics in a game and verify the expected distribution over many trials.
Everything runs in your browser — nothing is uploaded or stored.