Answer first: what this Coin Flip Calculator tells you
This Coin Flip Calculator computes the probability of getting a chosen number of heads (or tails) in N fair coin flips, plus the expected number of heads. It also estimates the chance of seeing at least one run of consecutive heads (or tails) of a given length.
With these outputs, you can quickly judge how likely different outcomes are and what to expect on average.
Core concepts: coin flips, fairness, and probability
A “fair” coin flip means P(Heads) = 0.5 and P(Tails) = 0.5. If flips are independent, the probability of a specific sequence depends only on how many heads appear, not on the order.
When you care about “exactly k heads out of N flips,” you use the binomial model.
Formula 1: probability of exactly k heads (binomial)
The probability of getting exactly k heads in N flips with fair probability is:
| Quantity | Meaning | Formula (fair coin) |
|---|---|---|
| P(X = k) | Probability of exactly k heads | C(N, k) · (0.5)^N |
| C(N, k) | Number of ways to choose k heads positions | N! / (k! (N-k)!) |
In plain terms: you count how many sequences have exactly k heads, then multiply by the probability of any one sequence.
Formula 2: probability of at least k heads (optional intuition)
Sometimes you want “at least k heads.” That is a sum of binomial probabilities:
P(X ≥ k) = Σ from i=k to N of C(N, i) · (0.5)^N
Because the calculator focuses on exact counts and run events, you’ll typically use the exact probability directly. But the same idea helps you interpret results.
Formula 3: expected number of heads
Even when outcomes vary, the average behavior is predictable. For a fair coin:
Expected heads = E[X] = N · 0.5
So if you flip 20 times, the expected number of heads is 10. This is not a guarantee for any single trial; it’s the long-run average.
Formula 4: chance of at least one run of consecutive results
A “run” is a streak of the same outcome. For example, a run of heads of length r means you see r heads in a row somewhere in the N flips.
Computing this exactly can be complex, so the calculator uses a dynamic-programming approach that counts all sequences without a run of length r, then subtracts from 1.
Chance of at least one run = 1 − P(no run of length r)
Variables:
- N: number of flips
- r: run length to look for (e.g., 3 means “three in a row”)
- Outcome: heads or tails
How to use the Coin Flip Calculator
Enter the values that match your question:
- N (number of flips): total flips you want to analyze.
- k (heads or tails count): the exact number of heads (or tails) you want to find probability for.
- Run length r: the streak length you want to check for (e.g., r=4 for “four in a row”).
- Outcome for run: choose Heads or Tails.
After you click Calculate, the calculator shows:
- Probability of exactly k heads/tails
- Expected number of heads
- Probability of at least one run of length r
Practical example 1: game fairness and “hot streak” claims
Suppose you run a small game where players roll a fair coin 30 times to determine a score. A player claims they “got an impossible streak” of 5 heads in a row. Set N = 30, choose run length r = 5, and compute the run probability for Heads.
If the probability is, say, 0.20, then a 5-head streak is unlikely but absolutely possible. That helps you respond with data instead of gut feeling.
Practical example 2: predicting outcomes for sampling and A/B checks
Imagine you flip a coin 50 times to randomly assign users to two groups (heads = Group A, tails = Group B). You want to know how often you’ll see exactly 26 heads. Use N = 50 and k = 26 to get the exact probability. The expected heads will be 25.
If the exact probability is small, it tells you that “exactly 26” is not the typical result—yet the assignment process remains fair.
Frequently Asked Questions
What is the probability of exactly k heads in N coin flips?
For a fair coin, the probability of exactly k heads in N flips is C(N, k) × (0.5)^N, where C(N, k) counts how many sequences have k heads. This uses the binomial distribution and assumes flips are independent and equally likely.
Does the calculator assume a fair coin?
Yes. The Coin Flip Calculator assumes a fair coin with P(Heads)=0.5 and P(Tails)=0.5. That matches the classic binomial model used for exact head counts and the run calculations. If your coin is biased, the probabilities will differ.
How should I interpret the “expected number of heads”?
The expected number is the long-run average of heads across many repeated experiments with the same N. For N flips, E[heads]=N/2. In any single trial you may see more or fewer heads, but the average trends to the expectation.
What does “at least one run” mean?
“At least one run of length r” means there exists a position in the sequence where r consecutive outcomes match (for example, r=4 heads in a row). It does not require multiple runs; a single qualifying streak is enough.
Why can long streaks happen even with a fair coin?
Fair coins still produce streaks because each flip is random and independent. Over many flips, there are more opportunities for streaks to occur. The run probability quantifies how often a streak of length r appears across N flips.
Quick tips for getting accurate results
- Use k only between 0 and N.
- Use run length r between 1 and N.
- If you are testing a real system, remember this calculator is for ideal fair randomness.
Bottom line
The Coin Flip Calculator turns common “coin flip” questions into exact probabilities and clear expectations. Use it to verify claims about streaks, to understand how often specific head counts happen, and to plan fair random assignment.