Coin Flip Simulator
Flip a coin any number of times and see the heads, tails and longest streak results.
Last updated · View algorithm, constants and default inputs (JSON)
Number of flips
About this calculator
Flipping a coin many times does not produce a neat alternation — long runs of the same side are far more common than people expect, because each flip is independent of the last. The simulator uses a seeded generator so the same seed always reproduces the same sequence.
Worked example
calculated with the default values below
Number of flips 100 · Seed (change it to rerun) 42 Heads 50 · Tails 50 · Heads 50.0 % · Tails 50.0 % · Longest run of one side 5 · Side of the longest run Heads · First 20 flips THTTHTHTTHHTTHHTTTHH
Disclaimer
These calculators give general estimates for information and entertainment. Platform algorithms, metrics and definitions change without notice, and none of these results are official figures from the platforms named.
Implementation source
This record describes the implementation used by this page. It is not independent validation. External references, when available, support only the stated formula or definition; estimates and custom rules retain their own assumptions.
Formula and variables
bestSide = side when runLength > longestRun
- U_i
- pseudo-random number in [0,1)
- H
- heads (outcome symbol)
- X_i
- 1 for heads, 0 for tails
- n
- number of flips
- h
- total heads
- P_h
- heads percentage
The side recorded is the one in the longest run; tied runs keep the first. The seeded generator is deterministic.
Frequently asked questions
What does the longest-streak side show?
It identifies the side in the longest consecutive run, not the side on the last flip. A seeded generator is deterministic and is not a source of true or cryptographic randomness.