Coin Flipper

Flip virtual coins online with this free coin flipper. Flip 1 to 100 coins at once, see heads/tails stats, streaks, and distribution.

Ad
Ad

About Coin Flipper

This coin flipper produces instant, fair results using the Web Crypto API. Flip a single coin for a visual heads-or-tails result, toss up to 100 coins at once to see the full distribution, or run a 1,000-flip fair coin test to verify the randomness for yourself. Every outcome is generated client-side with cryptographic-grade randomness.

How Does the Coin Flipper Work?

Each flip calls the browser's crypto.getRandomValues function, which draws entropy from the operating system's secure random number generator. According to the W3C Web Cryptography specification, implementations must use a cryptographically strong pseudo-random number generator seeded with high-quality entropy from the OS (such as /dev/urandom on Unix systems or the CNG API on Windows). This is the same class of randomness used for generating encryption keys and TLS session tokens - far stronger than Math.random(), which uses a deterministic PRNG that can be predicted if the internal state is known.

How the flip maps to a result: The tool generates a single random byte (0-255). Values 0-127 map to Heads, values 128-255 map to Tails. Because 128 values land in each bucket, the split is exactly 50/50 with zero rounding bias.

Flip ModeWhat You See
Single flipA large animated coin showing Heads or Tails
Multiple flips (2-100)Individual results for each coin, distribution bar, counts with percentages, and longest streak
Fair coin test (1,000 flips)Instant bulk test showing how close the results are to the expected 50/50 split

The Mathematics of Coin Flipping

A fair coin has exactly a 50% probability of landing on heads and 50% on tails for each individual flip. The outcomes of consecutive flips are independent - the coin has no memory of previous results. This independence is the foundation of Bernoulli trials, named after Swiss mathematician Jacob Bernoulli who formalised the concept in Ars Conjectandi (1713).

Worked example - expected range in 100 flips: With n = 100 flips and p = 0.5, the expected number of heads is np = 50. The standard deviation is sqrt(np(1 - p)) = sqrt(25) = 5. A 95% confidence interval spans roughly two standard deviations: 50 +/- 10, so between 40 and 60 heads. Getting 38 or 62 heads would be unusual but not extraordinary (about a 2.5% tail probability on each side). The Fair Coin Test button runs 1,000 flips and shows the actual deviation from 500, letting you confirm this empirically.

QuestionAnswerFormula
Probability of heads on one flip50% (0.5)P(H) = 1/2
Probability of 3 heads in a row12.5%(1/2)^3 = 1/8
Probability of 5 heads in a row3.125%(1/2)^5 = 1/32
Probability of 10 heads in a row0.098%(1/2)^10 = 1/1024
Expected heads in 100 flips50np = 100 x 0.5
Standard deviation for 100 flips5sqrt(np(1 - p)) = sqrt(25)

How Does the Binomial Distribution Apply?

When flipping a fair coin n times, the number of heads follows a binomial distribution B(n, 0.5). The probability of getting exactly k heads out of n flips is: P(k) = C(n, k) x (0.5)^n, where C(n, k) is the binomial coefficient "n choose k."

Worked example - exactly 50 heads in 100 flips: P(50) = C(100, 50) x (0.5)^100. The binomial coefficient C(100, 50) is approximately 1.009 x 10^29, so P(50) works out to roughly 7.96%. That means even with a perfectly fair coin, getting exactly 50 heads in 100 flips only happens about 8% of the time. Results of 45-55 heads are far more common collectively, covering about 72.9% of outcomes.

Heads in 100 FlipsProbabilityCumulative (this range)
Exactly 507.96%7.96%
45-5572.9%72.9%
40-6096.5%96.5%
35-6599.8%99.8%
30 or fewer / 70 or more0.003%Extremely rare

The law of large numbers guarantees that as the number of flips grows, the proportion of heads converges toward 50%. With 10 flips, getting 70% heads (7 out of 10) is common. With 10,000 flips, getting 70% heads is essentially impossible. The Fair Coin Test button demonstrates this nicely - 1,000 flips typically produces a result within 2-3% of 500 heads.

Are Physical Coin Flips Actually Fair?

A 2023 study by Frantisek Bartos and 47 co-authors flipped coins 350,757 times and found a same-side bias of 50.8% - coins tend to land on the side that was facing up when tossed. The bias comes from precession during the flip (the coin wobbles around its axis), a mechanism first described mathematically by Stanford statistician Persi Diaconis in a 2007 physics model that predicted a 51% same-side rate. The study was published in the Journal of the American Statistical Association in 2025.

The practical effect is small. If you bet on same-side outcomes 1,000 times, knowing the starting position would win you roughly 19 extra dollars compared to blind guessing. But the key requirement for a fair physical toss is that neither party sees which side faces up before the flip. A digital coin flipper sidesteps the issue entirely since there is no physical coin to precess - the randomness comes from an entropy source with no directional bias.

Other physical factors can also introduce bias. A coin that lands without bouncing (caught in the hand) shows less bias than one that clatters on a surface, because bouncing adds noise that partially cancels the precession effect. Coins spun on a table rather than flipped in the air show a much stronger bias toward the heavier side - a US penny spun on a table lands tails roughly 80% of the time because the Lincoln head side is slightly heavier.

Streaks and the Gambler's Fallacy

The flip history tracks the longest streak of consecutive heads or tails. Long streaks feel surprising, but they are mathematically expected. The expected length of the longest run in n fair coin flips is approximately log base 2 of n, a result formalised by Mark Schilling in The College Mathematics Journal (1990). For 100 flips, log2(100) is roughly 6.6, so seeing a streak of 7 is entirely normal.

Number of FlipsExpected Longest StreakChance of 5+ StreakChance of 10+ Streak
20~4~50%<1%
50~5-6~90%~3%
100~6-7~99%~10%
200~7-8~99.9%~25%
1,000~10~99.99%~75%

The gambler's fallacy is the belief that after a streak of heads, tails becomes "due." Each flip is independent - the coin has no memory of previous results. A streak of 10 heads does not make the 11th flip any more likely to be tails. The probability remains exactly 50%. This fallacy is well-documented in casino studies - roulette players routinely increase bets after a streak of one colour, despite each spin being independent. The most famous example is the Monte Carlo Casino incident of 1913, when the ball landed on black 26 times in a row and gamblers lost millions betting that red was overdue.

The related concept of the hot hand fallacy works in the opposite direction - people sometimes believe a streak means the pattern will continue. In coin flipping, neither belief has any basis. Each flip is a fresh, independent trial. The probability calculator can help work through more complex probability scenarios involving multiple events.

Common Uses for a Coin Flipper

Use CaseHow
Making a quick decisionAssign heads to one option, tails to the other, flip once
Picking who goes firstEach person calls it, flip to decide
Teaching probabilityFlip 100 coins and compare the distribution to the theoretical 50/50
Settling a debate fairlyBoth parties agree to abide by the result before flipping
Sports coin toss substituteWhen no physical coin is available
Random binary sequenceFlip multiple coins to generate a random string of H and T values

Coin flips are used as a decision-making tool in some surprisingly high-stakes contexts. The NFL uses a coin toss to determine which team receives the opening kickoff. In some US states, tied local elections are decided by a coin flip - the practice is codified in law in at least 35 states. The Portland Trail Blazers won a 1970 coin flip that gave them the first overall NBA draft pick (Geoff Petrie). When the stakes are lower, a coin flip works well for choosing restaurants, assigning chores, or deciding who drives.

Virtual vs Physical Randomness

Randomness SourceQualityUsed By This Tool?
Math.random()Pseudo-random, predictable with enough samplesNo
crypto.getRandomValues()Cryptographic-grade, seeded from OS entropy (hardware events, interrupt timing)Yes
Hardware RNG (e.g. Intel RDRAND)True hardware randomnessIndirectly - the OS entropy pool often includes hardware RNG output
Physical coin flipApproximately fair but with 50.8% same-side bias (Bartos et al., 2023)No

The crypto.getRandomValues() method is supported in all modern browsers and is the same API that the password generator and UUID generator rely on for secure output. For dice-based randomness, try the dice roller. For a custom numeric range, check the random number generator.

Tips for Getting the Most from This Tool

Use the Fair Coin Test first. Running 1,000 flips before making a decision lets you see that the tool produces results close to 50/50, building confidence that a single flip will be fair. Typical deviations are 1-3% from the expected 500/500 split.

Multi-coin flips for classroom demonstrations. Flipping 50 or 100 coins at once produces a distribution bar chart that visually demonstrates the normal distribution. The individual coin badges (H and T circles) make it easy to count and verify streaks by eye, which is useful when teaching the difference between local patterns and global averages.

The history panel tracks your session. Up to 20 recent flips are kept in the session history, showing the number of coins, the heads/tails split, and the percentage. This is useful for collecting multiple samples - flip 10 coins twenty times and compare the distributions across runs. Nothing is saved to a server or persisted after the page is closed.

Choosing between two options. If a coin flip is settling a decision, one technique is to flip the coin, then notice your immediate emotional reaction to the result. If you feel disappointed, that tells you which option you actually wanted, regardless of what the coin showed. The flip serves as a preference-revealing mechanism rather than a binding decision.

Sources

Frequently Asked Questions

Is the coin flip fair?

Yes. The coin flipper uses the Web Crypto API to generate cryptographically secure random values, giving a true 50/50 probability for each flip.

Can I flip multiple coins at once?

You can flip anywhere from 1 to 100 coins in a single toss. The tool displays each individual result plus overall heads/tails counts and percentages.

What is the fair coin test?

The fair coin test flips 1,000 coins at once and shows you the distribution. Over many flips the result should approach 50% heads and 50% tails, demonstrating the random number generator is unbiased.

Does it track streaks?

Yes. When flipping multiple coins, the tool identifies the longest consecutive streak of heads or tails in your results.

Is my flip history saved?

Your last 20 flips are kept in the session history panel, but nothing is saved to a server or persisted between page visits.

Link to this tool

Copy this HTML to link to this tool from your website or blog.

<a href="https://toolboxkit.io/tools/coin-flipper/" title="Coin Flipper - Free Online Tool">Try Coin Flipper on ToolboxKit.io</a>