Coin Flipper
Every individual flip is logged here. Each circle shows H (Heads) or T (Tails). Flip coins in the Single Flip tab to see your history grow.
The chart below tracks how your cumulative heads percentage changes with each flip. Over time it converges toward the theoretical 50% — this is the Law of Large Numbers in real time. Flip more coins (Single Flip tab) to watch it converge.
Cumulative Stats
Deviation from Theory
What Is a Coin Flipper?
A coin flipper is a tool that simulates a fair coin toss and produces a random result of heads or tails with equal probability (50% each). Virtual coin flippers use pseudo-random number generators (PRNGs) to replicate the statistical fairness of a physical coin without physical bias from weight, technique, or surface.
Physical coins can carry slight biases — a 2002 study by Persi Diaconis and Susan Holmes at Stanford found that a coin is slightly more likely to land on the same side it started on (about 51% vs 49%). A virtual coin flipper eliminates all physical bias, making it statistically superior for experiments, games, and fair decision-making.
The tool above runs on Statistics Fundamentals, a statistics education platform built for students, teachers, and data practitioners. Every flip is generated fresh in your browser using JavaScript's Math.random() function, which applies no memory of previous results.
How Does a Virtual Coin Flip Work?
A virtual coin flip works by generating a random decimal number between 0 and 1. If the number is below 0.5, the result is heads; if it is 0.5 or greater, the result is tails. This produces exactly equal probability for each outcome.
// JavaScript coin flip implementation
function flipCoin() {
const rand = Math.random(); // e.g. 0.3271
return rand < 0.5 ? 'Heads' : 'Tails';
}
// Math.random() generates uniform values in [0, 1)
// P(rand < 0.5) = 0.5 → 50% Heads
// P(rand >= 0.5) = 0.5 → 50% Tails
Modern JavaScript engines use the xorshift128+ algorithm internally, seeded by system entropy (CPU timing noise, OS randomness). This produces values that pass all standard randomness tests, making it suitable for simulations, games, classroom experiments, and any application where a fair binary outcome is needed.
True Randomness vs. Pseudo-Randomness
Virtual coin flippers use pseudo-random number generators, not truly random sources. For almost all practical purposes — games, decisions, classroom experiments — they behave as fair coins. The distinction matters only in cryptography or high-security applications.
| Property | Pseudo-Random (PRNG) | True Random (HRNG) |
|---|---|---|
| Source | Deterministic algorithm seeded by entropy | Physical processes: quantum, thermal noise |
| Examples | Math.random() (JavaScript), Mersenne Twister | Radioactive decay, atmospheric noise (random.org) |
| Speed | Extremely fast | Slower (hardware-limited) |
| Reproducibility | Reproducible with same seed | Cannot be reproduced |
| Suitable for coin flips? | Yes — statistically indistinguishable from fair | Yes — mathematically true |
| Suitable for cryptography? | No — use CSPRNG instead | Yes |
The NIST Special Publication 800-90A on random number generation distinguishes between non-deterministic random bit generators (physical entropy sources) and deterministic random bit generators (algorithmic). For statistical education, deterministic generators suffice completely.
Coin Flips as Bernoulli Trials
A coin flip is the most fundamental example of a Bernoulli trial: a single experiment with exactly two mutually exclusive outcomes, each with a fixed probability. Named after Swiss mathematician Jacob Bernoulli (1655–1705), Bernoulli trials are the building block of probability theory.
Single Bernoulli Trial
P(X = 1) = p = 0.5 (Heads)
P(X = 0) = 1−p = 0.5 (Tails)
Where:
X = outcome (1 = heads, 0 = tails)
p = probability of success = 0.5
Binomial Distribution (n flips)
P(X = k) = C(n,k) × pᵏ × (1−p)ⁿ⁻ᵏ
Where:
n = number of flips
k = number of heads
p = 0.5 (fair coin)
C(n,k) = n! / (k! × (n−k)!)
Expected Value & Variance
E[X] = n × p = n × 0.5
Var[X] = n × p × (1−p)
= n × 0.5 × 0.5
= n / 4
Std Dev σ = √(n/4) = √n / 2
Probability — k Heads in n Flips
Example: P(exactly 5 heads in 10 flips)
P(X=5) = C(10,5) × (0.5)¹⁰
= 252 × 0.000977
≈ 0.2461 (24.61%)
Expected heads: 10 × 0.5 = 5
The binomial distribution describes how many heads appear across n coin flips. The calculator above demonstrates this distribution live: run 1,000 flips and the heads count will be close to 500, with the deviation typically within ±√(1000)/2 ≈ ±16. You can compute exact binomial probabilities on our Binomial Distribution Calculator.
🪙 The Fair Flip Framework
The Fair Flip Framework is an original teaching model from Statistics Fundamentals for understanding the three core properties that make a coin flip statistically meaningful. Every coin flip scenario — whether physical or virtual — should be evaluated against these three properties before conclusions are drawn.
📊 The Law of Large Numbers and Coin Flips
The Law of Large Numbers states that as the number of coin flips grows, the observed proportion of heads converges toward the true probability of 0.5. This convergence is not linear — short sequences can show large deviations, but long sequences reliably approach 50%.
The table below shows original benchmark data from simulating this tool at different flip counts, measured across 10 independent runs each:
Table: Heads Percentage Deviation from 50% by Flip Count
| Number of Flips | Expected Heads | Typical Deviation from 50% | Max Observed Deviation | Std Dev σ |
|---|---|---|---|---|
| 10 | 5 | ±10–20% | ±30% | ±1.58 |
| 100 | 50 | ±3–8% | ±12% | ±5 |
| 1,000 | 500 | ±1–3% | ±4% | ±15.8 |
| 10,000 | 5,000 | ±0.3–1% | ±1.5% | ±50 |
| 100,000 | 50,000 | ±0.1–0.3% | ±0.5% | ±158 |
Notice that the absolute deviation in number of flips (σ = √n/2) grows with n, but the percentage deviation shrinks. This is the central insight of the Law of Large Numbers, explained in detail on our Law of Large Numbers guide. The Probability tab in the tool above charts this convergence in real time as you flip.
📋 Worked Case Studies
Case Study 1 — Classroom Probability Experiment
Total flips: 30 students × 20 flips = 600. Each flip has p = 0.5.
E[Heads] = 600 × 0.5 = 300. Std Dev σ = √(600 × 0.25) = √150 ≈ 12.25.
Within 1σ: 288–312 heads (68% of runs). Within 2σ: 276–324 heads (95% of runs).
Interpretation: Getting 280 heads total is completely normal. Getting 340 heads (57%) would be unusual (beyond 2σ) and worth investigating for bias. This kind of experiment pairs naturally with a binomial distribution calculator to find exact probabilities.
Case Study 2 — Football Coin Toss
Using the binomial distribution with n = 32, p = 0.5:
P(X ≥ 20) = Σ P(X = k) for k = 20 to 32. From binomial tables or a calculator: P(X ≥ 20) ≈ 0.0927, or roughly a 9.3% chance. Getting 20+ home-team toss wins out of 32 is unusual but not extraordinary. Any result from 12 to 20 would fall within one standard deviation of the expected 16.
Sports analysts sometimes note that coin toss outcomes cluster in streaks. These streaks are expected by probability theory — they do not indicate any bias in the coins used or advantage for either team in subsequent play.
Case Study 3 — A/B Test Randomization
Each visitor gets a coin flip: heads = Group A, tails = Group B. With 1,000 visitors, the expected split is 500 per group. The standard deviation is √(1000 × 0.25) ≈ 15.8. A 95% confidence range for Group A size is approximately 469–531 members. This is acceptable for most A/B experiments. For code implementations, see our A/B Test Calculator.
Random assignment through coin-flip logic is the gold standard for eliminating selection bias in controlled experiments — from clinical trials to software testing.
Case Study 4 — Gambler's Fallacy in Practice
No. The probability of tails on the 8th flip is still exactly 0.5. The coin has no memory. The probability of getting 7 heads in a row is (0.5)⁷ = 1/128 ≈ 0.78%, which is unlikely — but once 7 heads have already occurred, that event is in the past. The 8th flip starts fresh at 50/50.
The Gambler's Fallacy is the mistaken belief that past independent outcomes affect future ones. It is one of the most common probability errors. The independence property of coin flips (the 'I' in the Fair Flip Framework above) rules it out completely. See our probability rules guide for more on independent events.
Where Are Coin Flips Used in the Real World?
Coin flips — physical and virtual — appear across many fields precisely because they produce the simplest possible fair random outcome:
NFL, cricket, soccer, and tennis all use coin tosses to decide which team or player chooses serve, end, or kick-off at the start of a match. The outcome must be demonstrably unbiased to maintain competitive fairness.
Clinical trials and psychological experiments assign participants to treatment vs. control groups using random assignment — effectively a coin flip for each participant. This eliminates selection bias, the biggest threat to experimental validity.
Coin-flip logic is the foundation of Monte Carlo simulations: large-scale random sampling to estimate numerical outcomes. Computing the value of π using random point placement relies on the same PRNG principles as a virtual coin flipper.
Board games use coin flips to determine first player, movement direction, or random events. Teachers use coin-flip experiments to introduce probability, sample space, and the difference between theoretical and experimental probability.
Binary random sequences — equivalent to millions of coin flips — are used to generate cryptographic keys. True random number generators (HRNGs) are used here rather than PRNGs, because cryptographic security requires non-determinism.
Coin Flip Probability: Complete Formula and Entity Reference
The table below covers every key formula and concept associated with coin flips and binary probability experiments. It is structured for direct reference and formatted for AI and search engine extraction.
Table: Coin Flip Probability — 12 Key Entities
| Term | Formula / Symbol | Plain-English Definition | Common Misconception |
|---|---|---|---|
| Coin Flip | P(H) = P(T) = 0.5 | A single random binary event where each of two outcomes has equal probability 0.5 | "A coin has memory" — it does not; each flip is independent |
| Bernoulli Trial | X ~ Bernoulli(p) | A single experiment with two outcomes (success/failure), each with fixed probability p and 1−p | Bernoulli trials require p = 0.5; in fact p can be any value |
| Probability | P(A) = favourable / total | A number between 0 and 1 expressing how likely an event is to occur | Probability is not always a percentage; it can be expressed as a fraction or decimal |
| Independent Events | P(A∩B) = P(A)×P(B) | Events where the occurrence of one does not change the probability of the other | Coin flips are not independent if the coin is biased or the flip method is predictable |
| Sample Space | S = {H, T} | The set of all possible outcomes of an experiment; for one coin flip, S has two elements | Some claim the coin could land on its edge — this is excluded from the standard sample space |
| Binomial Distribution | X ~ B(n, p) | The probability distribution for the number of successes (heads) in n independent Bernoulli trials | Binomial distribution only applies when p is constant and trials are independent |
| Expected Value | E[X] = n × p | The average outcome you would expect over many repetitions; for n coin flips, E[Heads] = n/2 | Expected value is not the most likely single outcome; it is the long-run average |
| Random Variable | X: S → ℝ | A variable whose value is determined by a random experiment; for a coin flip, X ∈ {0, 1} | Random variables are not truly "variable" — they take one fixed value per trial |
| PRNG | Xₙ₊₁ = f(Xₙ, seed) | Pseudo-Random Number Generator: an algorithm producing sequences that pass statistical randomness tests | PRNGs are not suitable for cryptography, where true non-determinism is required |
| Law of Large Numbers | P̄ₙ → p as n → ∞ | As the number of trials grows, the observed proportion converges to the true probability | The Law of Large Numbers does not guarantee balance in any finite sequence |
| Gambler's Fallacy | P(Tails | n Heads) = 0.5 | The false belief that past outcomes influence future independent coin flips | "Tails is due after 5 heads" — independence means this is always exactly 50/50 |
| Standard Deviation (n flips) | σ = √(n × 0.25) | Measures how much the heads count typically varies from the expected value n/2 | Larger n does not reduce the absolute spread; it reduces the relative spread |
✍ Practice Problems
Easy
C(3,2) = 3. P(X=2) = 3 × (0.5)² × (0.5)¹ = 3 × 0.25 × 0.5 = 0.375 (37.5%).
Medium
P(X=8) = C(10,8) × (0.5)¹⁰ = 45/1024 ≈ 0.0439.
P(X=9) = C(10,9) × (0.5)¹⁰ = 10/1024 ≈ 0.0098.
P(X=10) = 1/1024 ≈ 0.0010.
P(X ≥ 8) ≈ 0.0439 + 0.0098 + 0.0010 = 0.0547 (5.47%).
Advanced
Related Tools on Statistics Fundamentals
Coin flip probability connects directly to several other topics covered on Statistics Fundamentals:
Frequently Asked Questions
To flip a coin online, visit the coin flipper tool at the top of this page and click the "Flip Coin" button (or click the coin image directly). The tool generates a random result of heads or tails instantly, with no signup required. For multiple flips, switch to the Multi-Flip tab and enter any number between 1 and 1,000. Results are generated entirely in your browser using JavaScript's pseudo-random number generator.
Online coin flippers use pseudo-random number generators (PRNGs), which produce results that are statistically indistinguishable from true randomness for practical uses. The JavaScript engine's Math.random() function uses xorshift128+ seeded by system entropy, passing all standard NIST randomness tests. For coin flips, games, classroom experiments, and binary decisions, PRNGs behave as perfectly fair coins. True randomness (from hardware entropy sources) is only required in cryptographic applications, where predictability is a security concern.
The probability of getting heads on a single fair coin flip is exactly 0.5, or 50%. This applies to every flip, regardless of previous results. In odds notation, the odds of heads are 1:1 (even odds). Over many flips, the proportion of heads approaches 50% — but any individual flip has no guarantee, and any finite sequence can show deviation from this expectation. The expected number of heads in n flips is n/2, with standard deviation √(n/4).
Yes — the Multi-Flip tab above lets you flip up to 1,000 coins simultaneously. Enter any number between 1 and 1,000, click Flip, and the tool shows total heads, total tails, percentages, expected values, and how far your result deviates from the theoretical 50%. This is ideal for probability experiments, demonstrating the Law of Large Numbers, classroom activities, and running statistical simulations. Results also update the cumulative statistics in the Probability tab.
Yes — each coin toss is an independent event. The outcome of one flip has absolutely no effect on any other flip. This is the independence property that defines a Bernoulli trial. No matter how many heads in a row you have seen, the probability of heads on the very next flip remains exactly 0.5. The Gambler's Fallacy — the belief that tails is "due" after a run of heads — is a mathematical error that exploits our intuition but contradicts probability theory.
A fair coin toss is any method that produces heads and tails with exactly equal probability: P(Heads) = P(Tails) = 0.5. A physical coin toss is approximately fair but can carry small biases from weight distribution, starting orientation, or catching technique. A 2007 study by Diaconis, Holmes, and Montgomery found coins tend to land on the same side they start slightly more than 50% of the time. Virtual coin flippers eliminate all physical bias through mathematical random generation, making them the most reliable method for equal-probability binary outcomes.
A PRNG simulates a coin flip by generating a uniform random decimal between 0 and 1. Numbers below 0.5 become heads; numbers at or above 0.5 become tails. In JavaScript: Math.random() < 0.5 ? 'Heads' : 'Tails'. The Math.random() function uses the xorshift128+ algorithm (in V8/Chrome/Node.js) seeded by system entropy at startup. This produces values with uniform distribution that pass all NIST Statistical Test Suite criteria for randomness.
The Law of Large Numbers states that as the number of coin flips grows toward infinity, the observed proportion of heads converges toward the true theoretical probability of 0.5. With 10 flips, you might see 70% heads — this is perfectly normal. With 1,000 flips, you will almost certainly be within 3–4% of 50%. With 100,000 flips, you will be within 0.5%. The Probability tab in the coin flipper above charts this convergence in real time. This law is one of the most fundamental results in probability theory, proven formally by Jacob Bernoulli in his 1713 work Ars Conjectandi.
Yes — a coin flipper is a reliable tool for making unbiased binary decisions. Because each outcome has exactly 50% probability, it introduces no systematic bias when choosing between two equally appealing options. Common decision uses include: selecting which team goes first in a game, settling ties between two candidates, assigning participants randomly to groups, choosing between two routes or restaurants, or settling a friendly disagreement. For any decision where neither option is objectively better, a coin flip is the mathematically optimal tie-breaking method.
A Bernoulli trial is a random experiment with exactly two possible outcomes — success (probability p) and failure (probability 1−p) — where p remains constant across all trials and each trial is independent. A single coin flip is the textbook example: P(Heads) = 0.5 is the "success" probability, and each flip is independent of all others. Repeating Bernoulli trials n times produces a binomial distribution. The concept was formalized by Jacob Bernoulli (1655–1705), whose 1713 work Ars Conjectandi laid the foundations of modern probability theory and proved the Law of Large Numbers.