User Rating 0.0
Total Usage 0 times
1 – 10,000,000
1 – 1,000
0.001 – 0.999 (0.5 = fair coin)
Track streaks of one side or both
Is this tool helpful?

Your feedback helps us improve.

About

Getting five heads in a row feels rare. Quantifying that intuition requires the theory of runs in Bernoulli sequences. For n independent tosses, each with success probability p, the chance of observing at least one run of k consecutive successes is non-trivial to compute. Naive approaches (multiplying pk) give the probability of a specific window, not of any window across n trials. This tool uses dynamic programming over the state space of current run lengths to deliver exact results, not approximations. Miscalculating streak probabilities leads to flawed gambling strategies, incorrect quality-control thresholds, and bad experimental design.

The calculator handles biased coins (p 0.5) and computes the expected number of tosses needed to first observe a streak. Note: the model assumes independent, identically distributed trials. Physical coins have slight bias (0.51) toward the starting face (Diaconis et al., 2007), and real flips are not perfectly i.i.d. For streaks of tails, the relevant probability is q = 1 p.

coin toss streak probability consecutive heads binomial trials runs test probability calculator coin flip statistics

Formulas

The probability of observing no streak of k consecutive successes in n tosses is computed via dynamic programming. Let S(i, j) be the probability of reaching toss i with a current run of exactly j consecutive successes and never having completed a run of k.

S(i, 0) = q k1j=0 S(i1, j)
S(i, j) = p S(i1, j1) for 1 j k1

The final probability of at least one streak of length k:

P(streak) = 1 k1j=0 S(n, j)

The expected number of tosses to first observe a streak of k consecutive successes is given by:

E(k) = ki=1 1pi

Where n = total number of tosses, k = desired streak length, p = probability of success on each toss (e.g. 0.5 for a fair coin), and q = 1 p = probability of failure.

Reference Data

Streak Length (k)P(streak) in 10 tossesP(streak) in 20 tossesP(streak) in 50 tossesP(streak) in 100 tossesExpected Tosses
298.05%99.998%≈100%≈100%6
382.62%98.68%99.997%≈100%14
450.78%86.80%99.52%99.998%30
524.61%61.77%95.08%99.77%62
610.94%37.35%82.07%96.78%126
74.69%19.80%61.72%85.36%254
81.95%9.85%41.07%65.25%510
90.78%4.72%24.55%43.07%1022
100.10%2.17%13.67%25.47%2046
12≈0%0.44%3.79%7.42%8190
15≈0%0.01%0.48%0.96%65534
20≈0%≈0%0.003%0.006%2097150

Frequently Asked Questions

The value (0.5)^5 = 3.125% is the probability of heads on five specific consecutive tosses (e.g., tosses 1-5). In 100 tosses, there are 96 overlapping windows where a streak could begin. The overlaps make exact calculation non-trivial - you cannot simply multiply 96 × 3.125% because windows share tosses. The dynamic programming approach accounts for these dependencies exactly. The true probability is approximately 81%.
A biased coin with p = 0.6 dramatically increases the probability of a heads streak. For a streak of 5 in 20 tosses: a fair coin yields ~62%, while p = 0.6 yields ~82%. Conversely, streaks of the less-likely outcome (tails at p = 0.4) become much rarer. The calculator lets you set p to any value in (0, 1) and automatically uses q = 1 − p for tail streaks.
It is the average number of tosses you must perform before observing a streak of k consecutive successes for the first time. For a fair coin and k = 5, the expected number is 62 tosses. The formula is a sum of a geometric series: E(k) = Σ(1/p^i) for i = 1 to k. This grows exponentially with k - each additional required consecutive success roughly doubles the expected wait time for a fair coin.
The model assumes independent, identically distributed Bernoulli trials. Persi Diaconis's research (2007) showed real hand-flipped coins land on the starting face ~51% of the time due to precession physics. For practical purposes, p = 0.5 is a good approximation for short experiments. For machine-flipped coins or truly random generators, the model is exact. The bias parameter lets you model the Diaconis effect by setting p = 0.51.
Yes. When you select "Either (Heads or Tails)" mode, the calculator computes the probability of a streak of k consecutive same-side results. For a fair coin this approximately doubles the probability compared to tracking only heads, because a tails streak is equally likely. The computation runs the DP twice (once for each outcome) and applies inclusion-exclusion to avoid double-counting overlapping streaks.
The algorithm is O(n × k) in time and O(k) in memory. For n = 100,000 and k = 1,000, computation takes under 50 milliseconds in modern browsers. The practical limit is n ≈ 10,000,000 before memory allocation becomes an issue. For typical use cases (n ≤ 10,000), results are instantaneous.