Article — Coin Flip Probability Calculator
Coin flip probability: a practical guide to the binomial distribution
- What the coin flip probability calculator does
- How to compute coin flip probability by hand
- Fair versus biased coin
- Coin flip probability and the law of large numbers
- Cumulative binomial probability
- Expected value and standard deviation of coin flips
- Real-world uses of the binomial model
- Common coin flip probability mistakes
A coin flip probability calculator applies the binomial distribution to count outcomes across n independent flips. For a fair coin and 10 flips, the probability of exactly 5 heads is 24.61 percent — the most likely single outcome, but only one of eleven possible head counts. The calculator above uses a log-gamma implementation of the binomial PMF (the same approach used by R's dbinom and Python's scipy.stats.binom) so it stays accurate from n equals 1 up to n equals 10,000.
The coin flip is the simplest example of a Bernoulli process: independent trials, two outcomes, fixed per-trial probability. Everything statistical about coin flips generalises to A/B tests, manufacturing defect counts, medical-trial responder rates and binary survey outcomes. Understanding the binomial here means understanding the binomial everywhere.
What the coin flip probability calculator does
Enter the number of flips (n) and the desired heads count (k). The calculator returns three probabilities: P(X equals k) for exactly k heads, P(X at least k) for k or more, and P(X at most k) for k or fewer. It also returns the expected value (n times p), the variance and the standard deviation, plus the equivalent odds expression for the exact-k probability.
The fair coin toggle assumes p equals 0.5. The biased toggle takes a custom per-flip probability between 0 and 1. The same binomial formula applies; only p changes. For n equals 100 and p equals 0.6, the expected number of heads is 60 and the standard deviation is approximately 4.9, so the typical range is roughly 50 to 70 heads.
P(X = k) = C(n,k) * p^k * (1-p)^(n-k)E[X] = n*p Var(X) = n*p*(1-p)SD = sqrt(n*p*(1-p))How to compute coin flip probability by hand
For 10 fair flips and k equals 5: C(10, 5) equals 252 (the number of ways to arrange 5 heads among 10 positions). Each specific arrangement has probability 0.5 to the tenth, which is 1 divided by 1,024. So P(X equals 5) equals 252 divided by 1,024, which is approximately 0.2461 or 24.61 percent. The same arithmetic works for any k: C(10, 0) equals 1 (only one way to get all tails) so P(X equals 0) equals 1 divided by 1,024 equals 0.098 percent.
For larger n the binomial coefficient grows fast. C(100, 50) is approximately 1.0 times 10 to the 29th — too large for direct factorial computation in standard floating point. The calculator computes everything in log space using a Lanczos approximation to the log-gamma function. This is the standard numerical approach in R, SciPy and Numerical Recipes; it keeps the answers accurate to about 12 significant digits up to n equals 10,000.
The statistician Karl Pearson flipped a coin 24,000 times in 1900 and recorded 12,012 heads (50.05 percent). The deviation from the expected 12,000 was 12 heads. The standard deviation for n equals 24,000 fair flips is the square root of 6,000, approximately 77.5, so 12 is well within one standard deviation. Pearson's data is still used in introductory statistics courses to illustrate the law of large numbers. He also coined the term "histogram" and founded the Biometrika journal.
Fair versus biased coin
A fair coin has p equals 0.5. A real coin is close but not exactly. A 2007 paper by Diaconis, Holmes and Montgomery showed that a vigorously tossed coin caught in the hand has a small bias toward landing on the same side it started, around 51 to 49. The bias vanishes when the coin bounces. For practical purposes, a household coin is fair.
Truly biased coins are easier to find in casinos than in pockets. Weighted dice, loaded roulette wheels and rigged slot machines all behave like biased Bernoulli trials with p far from 0.5. The same binomial formula applies; only the input p changes.
Coin flip probability and the law of large numbers
The law of large numbers says the observed proportion of heads converges to the true p as n grows. Convergence is slow: the standard deviation of the proportion shrinks like one over the square root of n. Going from 100 to 10,000 flips reduces the standard error tenfold, not a hundredfold. To pin the proportion within 0.1 percentage points at 95 percent confidence, you need about a million flips.
This is why polling research uses sample sizes around 1,000: that gives a margin of error around 3 percent. To halve the error you need 4 times the sample. The same calculus governs A/B testing.
For a fair coin the SD of the number of heads is √(n/4). For n = 100 that is 5, so 95 percent of trials land between 40 and 60 heads. For n = 10,000 the SD is 50; 95 percent of trials are between 9,900 and 10,100. The variance grows with n, but the proportion converges — the law of large numbers in one line.
Cumulative binomial probability
P(X equals k) is one number; the cumulative versions are usually more interesting. P(X at least 7) in 10 fair flips is about 17.19 percent. P(X at most 3) is also 17.19 percent (the distribution is symmetric for a fair coin).
Hypothesis tests on coin flips use the same machinery. If you flip 100 times and get 60 heads, is the coin biased? P(X at least 60 given p equals 0.5) is approximately 2.84 percent. At alpha equals 0.05 you reject the null of fairness; at alpha equals 0.01 you do not.
Expected value and standard deviation of coin flips
Expected number of heads is n times p. For 100 fair flips that is 50. Variance is n times p times one minus p, which is 25; SD is 5. The empirical rule applies approximately as n grows: plus or minus one SD covers about 68 percent of trials, plus or minus two SD covers 95 percent.
Real-world uses of the binomial model
A/B testing uses the binomial directly. Each visitor is a Bernoulli trial; conversion is heads, no-conversion tails. Clinical trials, manufacturing quality control and reliability engineering all run on the same machinery — binary outcomes accumulated across independent trials.
Genetics uses it for Mendelian inheritance — each child is a Bernoulli trial on each gene. Cryptography uses fair-coin assumptions to bound brute-force attack success. Anywhere you have independent trials with fixed binary outcomes, the binomial is the right model.
Common coin flip probability mistakes
The most common mistake is the gambler's fallacy: thinking past flips affect future ones. They do not. After five heads in a row, the next flip is still 50/50. The 1913 Monte Carlo Casino night when black hit 26 times consecutively at roulette is the canonical example — bettors lost millions on the false belief that red was due. The second common mistake is confusing P(X equals k) with P(X at least k); the cumulative versions are what most questions actually ask about. The third is using normal-distribution approximations for small n with p far from 0.5; the rule of thumb is np greater than 5 and n times one minus p greater than 5 before trusting the normal approximation.