Coin Flip Probability Calculator
Simulate coin flips and watch how the observed proportion compares to the theoretical 50% as the number of trials increases. This demonstrates the Law of Large Numbers in action.
What Is Coin Flip Probability?
Coin flip probability is the mathematical likelihood of getting a specific outcome — heads, tails, or a particular combination — when flipping a fair or biased coin one or more times. For a single flip of a fair coin, each side has a probability of exactly 0.5. When you flip the coin multiple times, the number of heads follows a binomial distribution, which lets you calculate the exact probability of any specific count of heads or tails.
The coin flip is one of the clearest examples of a Bernoulli trial: a random experiment with exactly two mutually exclusive outcomes, a fixed probability, and independence between repetitions. Because of this clean structure, coin flip problems appear throughout introductory statistics courses and serve as the foundation for understanding the binomial model. According to Khan Academy's binomial random variables review, the coin flip is the canonical example for teaching this distribution.
Coin Flip Probability Formulas
There are four core formulas for coin flip probability: exact probability of k heads, at-least cumulative probability, at-most cumulative probability, and specific sequence probability. All use the binomial distribution as the underlying model.
Exactly k Heads
P(X = k) = C(n,k) × p^k × (1−p)^(n−k)
n = number of flips
k = number of heads
p = P(heads) per flip
C(n,k) = n! / [k!(n−k)!]
At Least k Heads — P(X ≥ k)
P(X ≥ k) = Σ P(X = x)
for x = k to n
Sum the exact probabilities
from k through n.
= 1 − P(X ≤ k−1)
At Most k Heads — P(X ≤ k)
P(X ≤ k) = Σ P(X = x)
for x = 0 to k
Sum the exact probabilities
from 0 through k.
= 1 − P(X ≥ k+1)
Specific Sequence
Fair coin:
P(sequence) = (1/2)^n
Biased coin:
P(sequence) = p^h × (1−p)^t
h = heads in sequence
t = tails in sequence
The key distinction is between a specific sequence and any arrangement with k heads. The specific sequence HHTTH has exactly one way to occur. But "exactly 3 heads in 5 flips" can occur in C(5,3) = 10 different arrangements, which is why the combination C(n,k) multiplies the formula. The NIST/SEMATECH e-Handbook of Statistical Methods covers the binomial distribution and its applications in detail.
How to Calculate Coin Flip Probability — Step by Step
To find the probability of exactly k heads in n flips of a fair coin: identify n, k, and p; compute the combination C(n,k); raise p to the power k and (1−p) to the power (n−k); then multiply all three terms together.
Determine n (number of flips), k (desired number of heads), and p (probability of heads). For a fair coin, p = 0.5 and 1−p = 0.5. Example: n = 5 flips, k = 3 heads, p = 0.5.
C(n,k) = n! / [k!(n−k)!] counts the number of ways to choose which k of the n flips land heads. For our example: C(5,3) = 5! / [3! × 2!] = 120 / 12 = 10.
pk = 0.53 = 0.125. (1−p)n−k = 0.52 = 0.25. These represent the probability of getting heads on the chosen k flips and tails on the remaining n−k flips.
P(X = 3) = C(5,3) × 0.53 × 0.52 = 10 × 0.125 × 0.25 = 0.3125 = 31.25%.
State: "There is a 31.25% probability of getting exactly 3 heads in 5 independent flips of a fair coin." You can verify this using the Exact (X = k) tab in the calculator above.
Result: P(exactly 3 heads in 5 fair flips) = C(5,3) × 0.55 = 10 × 0.03125 = 0.3125 (31.25%). This is the most likely single outcome in 5 flips, but still less than one-in-three.
The Binomial Distribution and Coin Flips
The number of heads in repeated, independent coin flips follows a binomial distribution when: the number of flips is fixed, each flip has two outcomes (heads or tails), flips are independent, and the probability of heads is the same on every flip. Written formally: X ~ Binomial(n, p).
For a fair coin with n = 10 flips, the full distribution looks like this:
Table: Binomial Probability Distribution — Fair Coin, n = 10 Flips
| Heads (k) | C(10, k) | Probability P(X = k) | Percentage |
|---|---|---|---|
| 0 | 1 | 0.0009766 | 0.098% |
| 1 | 10 | 0.009766 | 0.977% |
| 2 | 45 | 0.04395 | 4.395% |
| 3 | 120 | 0.11719 | 11.719% |
| 4 | 210 | 0.20508 | 20.508% |
| 5 | 252 | 0.24609 | 24.609% |
| 6 | 210 | 0.20508 | 20.508% |
| 7 | 120 | 0.11719 | 11.719% |
| 8 | 45 | 0.04395 | 4.395% |
| 9 | 10 | 0.009766 | 0.977% |
| 10 | 1 | 0.0009766 | 0.098% |
Three facts stand out from this table. First, P(exactly 5 heads) = 24.6%, not 50% — a common source of confusion. Second, the distribution is symmetric around k = 5 for a fair coin. Third, the sum of all probabilities equals exactly 1.000, as it must for any valid probability distribution.
Fair Coin vs. Biased Coin Probability
A fair coin has P(heads) = 0.5 and P(tails) = 0.5. A biased coin has an unequal probability, such as P(heads) = 0.6 and P(tails) = 0.4. The binomial formula works for both; you simply substitute the actual value of p instead of 0.5.
Table: Fair Coin vs. Biased Coin — Exact Probability Comparison (n = 10 flips, k = 7 heads)
| Coin Type | P(heads) | C(10,7) | p7 | (1−p)3 | P(X = 7) |
|---|---|---|---|---|---|
| Fair coin | 0.5 | 120 | 0.007813 | 0.125 | 0.1172 (11.72%) |
| Biased coin | 0.6 | 120 | 0.02799 | 0.064 | 0.2150 (21.50%) |
| Biased coin | 0.7 | 120 | 0.08235 | 0.027 | 0.2668 (26.68%) |
| Biased coin | 0.4 | 120 | 0.001638 | 0.216 | 0.0425 (4.25%) |
The biased coin model assumes the same four conditions as the fair coin model: fixed n, two outcomes, independent flips, and constant p. The only thing that changes is the value of p. P(tails) is always 1−p, so you only need to specify one probability — the calculator enforces this constraint automatically.
Why C(n,k) Is Part of the Formula
C(n,k) = n! / [k!(n−k)!] counts the number of distinct arrangements of exactly k heads in n flips. Because each of those arrangements has the same probability pk(1−p)n−k, multiplying by C(n,k) gives the total probability of any outcome with exactly k heads.
Consider 3 flips (n = 3) and 2 heads (k = 2). The possible arrangements are HHT, HTH, and THH — three arrangements, each with probability (0.5)²(0.5)¹ = 0.125. C(3,2) = 3 captures this count. Total probability = 3 × 0.125 = 0.375 = 37.5%.
Order matters when calculating a specific sequence (HHT is different from HTH). Order does not matter when asking "how many arrangements contain exactly k heads" — that question asks for the count of such arrangements, which is what C(n,k) provides. The OpenStax Introductory Statistics textbook (Section 4.3) develops this reasoning in full.
Expected Value, Variance, and Standard Deviation of Coin Flips
For X ~ Binomial(n, p), the expected number of heads is E(X) = np, the variance is Var(X) = np(1−p), and the standard deviation is SD(X) = √[np(1−p)]. For a fair coin with n = 10: E(X) = 5, Var(X) = 2.5, SD(X) ≈ 1.58.
Table: Expected Value and Spread for a Fair Coin (p = 0.5) at Different n
| Flips (n) | E(X) = np | Var(X) = np(1−p) | SD(X) = √Var | P(exactly n/2 heads) |
|---|---|---|---|---|
| 2 | 1.00 | 0.500 | 0.707 | 50.00% (k=1) |
| 4 | 2.00 | 1.000 | 1.000 | 37.50% (k=2) |
| 6 | 3.00 | 1.500 | 1.225 | 31.25% (k=3) |
| 10 | 5.00 | 2.500 | 1.581 | 24.61% (k=5) |
| 20 | 10.00 | 5.000 | 2.236 | 17.62% (k=10) |
| 100 | 50.00 | 25.000 | 5.000 | 7.96% (k=50) |
The probability of getting exactly half heads decreases as n increases, even though the expected value stays at n/2. This is not a contradiction: with more flips, the distribution spreads over a wider range of possible outcomes, so any single outcome becomes less likely — even the most probable one.
Theoretical Probability vs. Experimental Probability
Theoretical probability is calculated mathematically from assumptions: P(heads) = 0.5 for a fair coin. Experimental probability is measured from actual flips: if you flip 10 times and get 7 heads, the experimental probability is 7/10 = 0.7. These two values may differ, especially for small numbers of flips.
This is not a contradiction. The theoretical probability describes the long-run tendency, not any specific short-run result. With only 10 flips, getting 7 heads (or 3 heads, or 9 heads) is entirely possible and does not indicate a biased coin. The Law of Large Numbers guarantees that as the number of flips grows, the observed proportion converges toward the theoretical probability of 0.5 — but convergence is a statement about the limit, not about any individual experiment.
The Gambler's Fallacy
The gambler's fallacy is the belief that a run of one outcome makes the opposite outcome "due." If a fair coin lands tails ten times in a row, the probability of heads on the next flip is still exactly 0.5 — not higher. This is because coin flips are independent events; a coin has no memory of previous results.
The fallacy feels intuitive because we know the long-run proportion should approach 50/50. But the mechanism behind that convergence is not that future flips compensate for past ones — it's that past results become diluted by future ones as n grows. Ten tails followed by ten million fair flips will produce a proportion very close to 50%, not because the tails were "corrected" but because the ten early tails are a tiny fraction of the total. The Stanford Encyclopedia of Philosophy's entry on probability addresses this distinction in detail.
The Law of Large Numbers
The Law of Large Numbers states that as the number of independent trials increases, the sample proportion converges toward the true probability. For a fair coin, the proportion of heads approaches 0.5 as n grows — but individual experiments will still vary around this value.
The Law of Large Numbers does not guarantee that any specific number of flips will produce exactly 50% heads. It guarantees convergence in the limit. With n = 10, you might observe 30% or 70% heads. With n = 10,000, you will almost certainly be within a few percentage points of 50%. Use the Simulator tab in the calculator above to observe this convergence directly with different numbers of trials.
Common Misconceptions About Coin Flip Probability
Worked Examples
n = 1, k = 1, p = 0.5. P(X = 1) = C(1,1) × 0.51 × 0.50 = 1 × 0.5 × 1 = 0.5 (50%). Interpretation: There is a 50% probability of getting heads on a single flip of a fair coin.
n = 2, k = 2, p = 0.5. P(X = 2) = C(2,2) × 0.52 × 0.50 = 1 × 0.25 × 1 = 0.25 (25%). The only way to get two heads in two flips is HH, which has probability 0.5 × 0.5 = 0.25.
n = 5, k = 3, p = 0.5. C(5,3) = 10. P(X = 3) = 10 × (0.5)3 × (0.5)2 = 10 × 0.03125 = 0.3125 (31.25%).
P(X ≥ 3) = P(X=3) + P(X=4) + P(X=5) = 0.3125 + 0.15625 + 0.03125 = 0.5000 (50%). By symmetry of the fair coin, half of all outcomes have ≥3 heads out of 5.
P(X ≤ 2) = P(X=0) + P(X=1) + P(X=2) = 0.000977 + 0.009766 + 0.043945 = 0.05469 (5.47%). Getting 2 or fewer heads in 10 flips is quite rare.
P(X = 10) = (0.5)10 = 1/1024 ≈ 0.000977 (0.098%). Less than 1 in 1,000 experiments would produce all heads in 10 flips.
Each flip is independent. P(HTHTH) = 0.5 × 0.5 × 0.5 × 0.5 × 0.5 = (0.5)5 = 1/32 = 0.03125 (3.125%). The same as HHHHH or any other specific 5-flip sequence.
C(10,7) = 120. p7 = 0.67 ≈ 0.02799. (1−p)3 = 0.43 = 0.064. P(X=7) = 120 × 0.02799 × 0.064 ≈ 0.2150 (21.50%).
E(X) = np = 20 × 0.5 = 10 heads. Variance = np(1−p) = 20 × 0.5 × 0.5 = 5. Standard deviation = √5 ≈ 2.24 heads.
Still exactly 0.5 (50%). Flips are independent events. A coin has no memory. This is the gambler's fallacy to believe otherwise.
Coin Flip Probability in Excel and Google Sheets
Both Excel and Google Sheets include a built-in binomial probability function. You do not need to implement the formula manually.
Excel / Google Sheets Functions
| Calculation | Excel / Sheets Function | Example (n=10, k=3, p=0.5) |
|---|---|---|
| Exactly k heads | BINOM.DIST(k, n, p, FALSE) | =BINOM.DIST(3, 10, 0.5, FALSE) → 0.1172 |
| At most k heads (cumulative) | BINOM.DIST(k, n, p, TRUE) | =BINOM.DIST(3, 10, 0.5, TRUE) → 0.1719 |
| At least k heads | 1 − BINOM.DIST(k−1, n, p, TRUE) | =1−BINOM.DIST(2, 10, 0.5, TRUE) → 0.9453 |
| Combination C(n,k) | COMBIN(n, k) | =COMBIN(10, 3) → 120 |
The fourth argument in BINOM.DIST is a logical flag: FALSE returns the exact probability P(X = k); TRUE returns the cumulative probability P(X ≤ k). This distinction maps directly to the Exact and At-Most tabs in the calculator above.
Coin Flip Probability in JavaScript and Python
JavaScript — Binomial Probability
function factorial(n) {
if (n <= 1) return 1;
let r = 1;
for (let i = 2; i <= n; i++) r *= i;
return r;
}
function combination(n, k) {
return factorial(n) / (factorial(k) * factorial(n - k));
}
function binomialPMF(n, k, p) {
return combination(n, k) * Math.pow(p, k) * Math.pow(1 - p, n - k);
}
// Example: P(X = 3) in 5 fair flips
console.log(binomialPMF(5, 3, 0.5)); // 0.3125
Python — Binomial Probability
from scipy.stats import binom
n, k, p = 10, 3, 0.5
# Exactly k heads
print(binom.pmf(k, n, p)) # 0.1171875
# At most k heads
print(binom.cdf(k, n, p)) # 0.171875
# At least k heads
print(1 - binom.cdf(k - 1, n, p)) # 0.9453125
# Expected value and variance
print(binom.mean(n, p)) # 5.0
print(binom.var(n, p)) # 2.5
Related Calculators and Guides
These tools and guides from Statistics Fundamentals cover the concepts connected to coin flip probability.
Frequently Asked Questions
The probability of heads on a fair coin is exactly 0.5, or 50%. A fair coin is defined as one where each outcome — heads or tails — is equally likely. This makes it one of the simplest examples of a uniform probability distribution with two outcomes.
Use the binomial formula: P(X = k) = C(n,k) × pk × (1−p)n−k, where n is the total number of flips, k is the desired number of heads, and p = 0.5 for a fair coin. C(n,k) = n! / [k!(n−k)!] accounts for all the different orders in which k heads can appear among n flips.
P(X = 3) = C(5,3) × (0.5)3 × (0.5)2 = 10 × 0.125 × 0.25 = 0.3125, or 31.25%. There are 10 different orderings of 3 heads and 2 tails across 5 flips, each with probability (0.5)5 = 1/32. Summing those 10 arrangements gives 10/32 = 5/16 = 0.3125.
The probability of exactly 5 heads in 10 flips is about 24.6%, not 50%. The 50% probability refers to each individual flip, not to the outcome of exactly half the flips in a sequence. There are 210 = 1,024 possible outcomes for 10 flips. Getting exactly 5 heads can happen in C(10,5) = 252 of those ways, so P(X = 5) = 252/1024 ≈ 0.246.
Yes — for a fair coin, every specific ordered sequence of n flips has the same probability: (0.5)n. HHHHH and HTHTH both have probability (0.5)5 = 1/32. The confusion arises because HHHHH looks unusual. But no sequence is inherently more or less likely than any other of the same length.
No. Coin flips are independent events. A physical coin has no memory of previous outcomes. The probability of heads on any given flip is always p, regardless of what happened before. This is a defining property of the binomial model. Believing otherwise is the gambler's fallacy.
The gambler's fallacy is the incorrect belief that after a run of one outcome, the opposite outcome becomes more likely to restore the expected balance. After 10 consecutive tails, the probability of heads on the next flip is still exactly 0.5 — not higher. The Law of Large Numbers applies to the long-run proportion, not to individual future outcomes, and it does not "correct" past streaks.
P(10 heads in a row) = (0.5)10 = 1/1024 ≈ 0.000977, or about 0.098%. This is a specific sequence (HHHHHHHHHH), so no combination factor is needed. It is the same probability as any other specific 10-flip sequence. The calculation is the same as P(X = 10) in the binomial formula.
E(X) = np = 10 × 0.5 = 5 heads. This is the average you would expect across many repetitions of 10-flip experiments. The variance is Var(X) = np(1−p) = 10 × 0.5 × 0.5 = 2.5, and the standard deviation is √2.5 ≈ 1.58 heads.
For a biased coin, substitute the actual probability p into the binomial formula instead of 0.5. If P(heads) = 0.6, then P(tails) = 0.4, and P(X = k) = C(n,k) × 0.6k × 0.4n−k. The expected number of heads becomes E(X) = np = 10 × 0.6 = 6 for 10 flips, and the distribution shifts toward more heads.
P(X ≥ 1) = 1 − P(X = 0) = 1 − (0.5)n. For n = 5: P(X ≥ 1) = 1 − (0.5)5 = 1 − 0.03125 = 0.96875 = 96.875%. Using the complement rule is often the fastest approach when calculating at-least-1 probabilities.
There are 2n possible ordered outcomes for n coin flips: 2 for 1 flip, 4 for 2 flips, 8 for 3 flips, 1,024 for 10 flips, and 1,048,576 for 20 flips. For a fair coin, each of these 2n outcomes is equally likely, with probability (0.5)n each.