Coin Flip

Flip a fair coin — or a whole handful — and watch the session statistics build: heads, tails, percentages, and your longest streak, with the probability math explained below.

Session tally

0heads
0tails
heads share
longest streak

Click “Flip”. Each coin is an independent fair bit.

How this calculator works

Every coin is one independent random bit from the browser's cryptographic generator — a genuine 50/50 with no starting-side bias, which (see the FAQ) is fractionally fairer than actual metal. Set the count to flip several coins at once, and the session tally accumulates across clicks: total heads and tails, the running heads percentage, and the longest streak either side has managed.

The tally is the quiet lesson of the page. Watch the percentage wobble wildly for the first dozen flips and then settle toward 50% as the session grows — the law of large numbers happening in front of you — while the streak counter demonstrates that surprisingly long runs are a routine feature of fair coins, not evidence against them.

The formula

P(heads) = 1/2 per flip, flips independent

P(exactly k heads in n flips) = C(n, k) / 2ⁿ
P(streak of s starting at a given flip) = 1 / 2ˢ

The binomial distribution governs multi-coin flips — any introductory probability text covers it (e.g., Blitzstein & Hwang, Introduction to Probability, the Harvard course text). The aside about physical coins being ~51% biased toward their starting side is Diaconis, Holmes & Montgomery, "Dynamical Bias in the Coin Toss," SIAM Review 49(2), 2007 — Stanford's contribution to settling bar bets.

Worked example

Flip 10 coins at once and ask: how likely is exactly half heads?

  1. Ways to choose which 5 of 10 coins are heads: C(10,5) = 252
  2. Total equally likely outcomes: 2¹⁰ = 1,024
  3. P(exactly 5 heads) = 252 ÷ 1,024 = 24.6%
  4. Meanwhile P(4, 5, or 6 heads) = (210 + 252 + 210) ÷ 1,024 = 65.6%

"Roughly half" is common; "exactly half" happens only a quarter of the time. Set the coin count to 10 and flip a dozen times — your tally of exactly-5 results should land near 3 of 12.

Assumptions & tips

  • Set the terms before the flip. Who is heads, how many flips, result stands — agreed out loud first. The coin is never the problem; the terms are.
  • Streaks are normal — budget for them. In 25 flips, a run of five is close to a coin flip itself. If a streak would ruin your game or classroom demo, decide in advance how you'll treat it.
  • Use multi-coin mode for binomial demos. Ten coins per click, tally the heads counts, and a bell shape emerges in real data within minutes — the fastest statistics lesson there is.
  • Never "even things out" by hand. If you find yourself re-flipping until the tally looks balanced, you're manufacturing the exact bias the coin doesn't have.
  • More than two options? The spinner wheel is this coin with n sides — same RNG, same fairness argument, more wedges.

Frequently asked questions

Is a virtual coin flip fairer than a real one?

Slightly, yes. Stanford researchers (Diaconis, Holmes, and Montgomery, 2007) showed that a real caught coin has about a 51 percent bias toward landing the same way up it started, because of the physics of precession. This page's flip is a single cryptographically random bit — exactly 50/50, with no starting side to favor. For settling arguments, both are fine; for teaching probability, the digital coin actually matches the textbook better than metal does.

I got five heads in a row — is the coin broken?

No — you got a run that surprises people but not probability. Five heads in a row has chance 1/32 from any given starting flip, and across a session of 25 flips there is roughly a 50 percent chance of seeing a streak of five somewhere. Long runs in fair sequences are the norm, not the exception, which is exactly why humans are terrible at faking random data.

Does a streak of heads make tails "due"?

No — that is the gambler's fallacy. The coin has no memory: after ten heads, the chance of another head is still exactly one half. What is true is that in the long run the proportion of heads converges toward 50 percent (the law of large numbers) — but it converges by drowning early streaks in new flips, not by compensating for them.

What are the odds of exactly half heads?

Lower than intuition says. In 10 flips, exactly 5 heads happens 24.6 percent of the time; in 100 flips, exactly 50 heads is only 8 percent. "About half" is overwhelmingly likely, but "exactly half" gets rarer as flips grow — the binomial distribution spreads over more outcomes.

How do I flip for something important, like who gets the last office?

Agree the terms out loud before the flip: who is heads, best of one or best of three, and that the result stands. Then flip once and honor it. Every coin-flip dispute in history has been about the terms, not the physics.

Sources

  1. Web Cryptography API — World Wide Web Consortium (W3C) Recommendation, 26 January 2017. §10.2.1, the getRandomValues method. w3.orgDefines crypto.getRandomValues, the source of the single cryptographically random bit behind each flip and the basis for calling this coin exactly 50/50.
  2. Dynamical Bias in the Coin Toss — Persi Diaconis, Susan Holmes and Richard Montgomery, SIAM Review, volume 49, number 2, pages 211–235, 2007. DOI 10.1137/S0036144504446436. stat.berkeley.eduThe high-speed-photography measurement behind the FAQ's claim that a real caught coin lands the way it started about 51% of the time, and the precession argument that explains it. Linked to a freely readable university copy; the SIAM version is paywalled.
  3. Introduction to Probability — Charles M. Grinstead and J. Laurie Snell, 2nd edition, American Mathematical Society, 2003; freely redistributable edition dated 2006. math.dartmouth.eduChapter 3 for the combinations and binomial probabilities behind the worked example (252 of 1,024 ways to get exactly 5 heads in 10), and Chapter 8 for the law of large numbers that governs the drifting heads share in the session tally.
  4. Introduction to Probability — Joseph K. Blitzstein and Jessica Hwang, 2nd edition, Chapman and Hall/CRC, 2019. ISBN 978-1-138-36991-7. The introductory text this page's formula section names for the binomial distribution governing multi-coin flips and the independence of successive flips. Cited bibliographically: no stable free full text to link.
  • Random Team Picker

    Split any list of names into fair random teams — unbiased shuffle, by team count or team size.

  • Spinner Wheel

    Add your options, spin the wheel, get a fair pick — the result comes from an unbiased RNG, not the animation.

  • Blackjack Odds Calculator

    Exact dealer bust rates by upcard and the true EV of standing, hitting, or doubling any hand.

  • Poker Odds Calculator

    Outs to exact turn and river odds, the rule of 2 & 4 checked, and pot-odds break-evens for Hold’em.