Coin Flipper - Single and Batch Flips
Use this coin flipper to flip a coin online one time or in batches. Set the heads probability for a fair or biased coin and read the full H/T sequence plus counts.
Coin Flipper
Results
What this tool does
A coin flipper is a virtual coin you can flip from a web page instead of carrying a real one. The form takes a batch size, an optional heads probability, and an optional seed for reproducible sequences. Every input change reruns the batch and refreshes the H/T sequence and counts.
- • Quick tiebreakers: settle a one-off decision between two choices without needing a physical coin.
- • Classroom drawings: assign students to groups, pick a question order, or choose a random presenter.
- • Probability demonstrations: show how a sequence of 10 or 100 flips approaches the chosen heads probability as the batch grows.
- • Reproducible randomness: use a seed to regenerate the exact same sequence for a board game or a teaching demo.
Each flip is an independent Bernoulli trial with the same heads probability, so the count of heads across n flips follows the binomial distribution. The page draws n uniform random numbers, compares each to the heads probability to build a clean H/T sequence, and reports the tally in the same view. A coin flipper like this one is the simulation side of probability: it actually runs the experiment instead of computing a closed-form probability.
If you only need the theoretical probability of a certain number of heads in n flips, the binomial probability calculator handles that without random draws.
For the theoretical chance of k heads in n flips, Coin Flip Probability Calculator returns the binomial probability without simulating anything.
How the random draw works
The simulator draws one uniform random number per flip and compares it to the chosen heads probability. A draw below p counts as heads; otherwise it counts as tails. Repeating that comparison n times produces the full H/T sequence and the running tally. In other words, the coin flipper runs the same Bernoulli logic on every batch, whether n is 1 or 10000.
- n: independent flips to simulate. Integer from 1 to 10000, default 10.
- p: probability of heads on a single flip. 0.5 is a fair coin; 0 to 1 covers weighted coins.
- seed: optional integer that seeds a deterministic pseudo-random sequence. Empty or zero falls back to Math.random.
The random number comes from the browser's Math.random() when no seed is provided, or from a small mulberry32 generator when a seed is provided. mulberry32 returns floats in [0, 1), which is the standard uniform interval used to compare against a probability threshold. The same seed always returns the same sequence, so reproducibility is built into the simulator rather than added on top. After each flip the result is added to a sequence string, a heads counter, and a tails counter. The percent values are computed once at the end, so the shares always sum to 100.00% and you can read either side to cross-check the other.
Worked example: 10 fair flips with seed 1234
n = 10, p = 0.5, seed = 1234. Each u_i in [0, 1) below 0.5 is heads (H), the rest are tails (T).
A deterministic 10-character sequence such as H T T H H T H T T H with 5 heads and 5 tails (50.00% heads).
The same seed always produces the same sequence, which makes the page useful for repeating a class demo or a board-game session.
According to MDN Web Docs, Math.random, Math.random returns a floating-point, pseudo-random number in the range 0 to 1 (inclusive of 0, exclusive of 1), which is exactly the uniform draw the simulator uses.
If you need a uniform random number in a custom interval rather than a 0/1 outcome, Random Number Generator extends the same pseudo-random idea to user-chosen ranges.
Key concepts behind the random draw
Four ideas make the simulator behave the way you expect. Each one explains a small piece of how a virtual coin toss turns into a sequence, a tally, and a probability statement.
Bernoulli trial
A single flip is a Bernoulli trial: one of two outcomes with a fixed success probability. The simulator runs one Bernoulli trial per flip, so the whole sequence is just n independent trials stacked together.
Uniform random draw
Each flip starts with a uniform random number in [0, 1). Comparing that draw to the heads probability turns a continuous value into a clean 0/1 outcome, the standard way to simulate a coin toss on a computer.
Independence between flips
Each flip uses a fresh random draw and does not look at any previous result. That independence keeps the long-run heads share close to p and lets the simulator treat every batch as a fresh experiment.
Deterministic seed
A seed turns the random sequence into a deterministic one. With the same seed the simulator always returns the same H/T sequence, the simplest way to repeat a board-game tiebreaker or a classroom demo exactly.
Independence is the assumption most often broken in real experiments. Drawing without replacement, sharing a coin with a known result, or stopping after a streak all break independence and change what the output means. The seed concept is borrowed from pseudo-random number generators: Math.random() uses an internal seed the browser does not expose, which is why two empty-seed runs almost never repeat. Entering an explicit seed overrides that behavior and turns the page into a deterministic simulator you can rewind and replay.
Once the page produces a sequence, Coin Flip Streak Calculator can analyze the same data for the longest heads run and the probability of streaks of a given length.
How to use the simulator
Set the three inputs, then read the four output rows and the full H/T sequence. The form updates on every input change, so adjusting the heads probability or the seed reruns the batch without any extra click.
- 1 Enter the number of flips: type the integer n into the first input. The default 10 is a common size; the form accepts 1 to 10000.
- 2 Choose the heads probability: set p to 0.5 for a fair coin, or any value from 0 to 1 for a weighted coin.
- 3 Optionally enter a seed: type any integer to reproduce the same sequence on later runs. Leave the field empty for a fresh random batch every time the inputs change.
- 4 Read the flip sequence: the sequence box lists H for heads and T for tails in flip order, separated by spaces. Long sequences wrap so the result still fits on a phone screen.
- 5 Check the heads and tails counts: they must sum to n and the shares must add up to 100.00%.
- 6 Reset for the next batch: press Reset to clear the form back to n = 10, p = 0.5, empty seed.
For a quick tiebreaker between two players, leave the seed empty, set n = 1 and p = 0.5, and read the first character of the sequence. For a classroom drawing of three winners from twenty students, set n = 20 and p = 0.5, then read the sequence: every flip that lands on heads is a chosen student, and the heads count tells you how many winners to draw.
After the simulator returns the realized count of heads, Binomial Distribution Calculator can compare it against the theoretical binomial distribution to check how typical the result is.
Benefits of using this simulator
The page combines a single-flip action, a multi-flip batch, an optional seed, and a tally in one form, so a coin flipper here answers the most common coin-tossing questions without extra tools.
- • One click for any batch size: run a single flip for a tiebreaker or 1000 flips for a Monte Carlo demo without leaving the same form.
- • Fair and biased coins in one place: the heads probability field accepts any value from 0 to 1.
- • Reproducible sequences: the optional seed turns the random batch into a deterministic one.
- • Counts and percent in one view: heads count, tails count, heads share, and tails share appear in the results panel so the realized outcome is readable at a glance.
- • Real-time updates: the form recomputes the sequence on every input change.
The most common use of a virtual coin is a single decision, but the same form scales up to multi-flip experiments because the math is identical. A 1-flip run and a 1000-flip run use the same Bernoulli comparison, so adding more flips only changes the size of the output, not the rule that produces it. Cross-checking the realized share against the theoretical mean n*p is also the fastest way to spot a typo in p or a bug in the random draw, which is why the page exposes the count as well as the sequence.
If the realized heads share needs to be turned into a probability statement for a single event, Probability Calculator covers the same calculation in a different form.
Factors that affect the results
The numbers are only as accurate as the assumptions behind each flip. Four practical factors change what the sequence really means.
Heads probability value
Lower p makes tails more common, higher p makes heads more common, and p = 0.5 splits the batch evenly on average. The page accepts any p from 0 to 1 so a measured or assumed bias can be entered directly.
Batch size
A small batch can show large swings away from the expected share. With p = 0.5, ten flips often land between 30% and 70% heads, while a thousand flips stay much closer to 50%.
Pseudo-random quality
Math.random() is fine for a virtual coin toss, but it is not cryptographically secure. Use the seed field if the result has to be reproducible; use a dedicated randomness source if the result has to resist prediction.
Independence assumption
Each flip is independent of the others. Stopping after a streak or drawing without replacement all break independence, and the simulator output should not be reused in those cases.
- • The page runs in your browser and uses Math.random() by default. Two empty-seed visits will produce different sequences, and that difference is by design, not a bug.
- • The form caps the batch at 10000 flips to keep rendering fast on phones and tablets. Larger experiments should be split into multiple batches.
- • The page does not show the underlying random draws. The seed field lets you reproduce the exact sequence.
Real physical coins are slightly biased in practice, so a measured p different from 0.5 is reasonable for a careful experiment. For a classroom demo or a board-game tiebreaker, Math.random() is plenty; for security-sensitive draws, replace the simulator with a true random source.
According to Wikipedia, Coin flipping, a physical coin flip is a classic way to produce a fair binary random outcome, but real coins can show small biases depending on the coin and flip technique, which is why this tool lets you choose the heads probability.
For the underlying model, the NIST/SEMATECH e-Handbook of Statistical Methods describes a Bernoulli trial as a single experiment with exactly two outcomes and a constant success probability, which is the assumption the simulator stacks into the full H/T sequence.
For waiting-time questions like how many flips until the first heads, Geometric Distribution Calculator returns the matching probability from the related geometric model.
Frequently Asked Questions
Q: How does the coin flipper decide heads or tails?
A: The coin flipper draws one uniform random number per flip from the range 0 to 1 and compares it to the heads probability p. If the draw is below p the flip counts as heads; otherwise it counts as tails. Repeating the comparison n times produces the full H/T sequence.
Q: Can I flip more than one coin at a time?
A: Yes. Set the number of flips to any integer from 1 to 10000 and the coin flipper will run that many independent flips in one batch and report the full H/T sequence along with the heads and tails counts.
Q: Is the coin flipper truly random?
A: By default the coin flipper uses the browser Math.random function, which is a pseudo-random source suitable for tiebreakers, classroom drawings, and Monte Carlo demos. For exact reproducibility, enter any integer in the seed field and the same sequence will be returned on every run.
Q: What is the difference between a fair and a biased coin flip?
A: A fair coin has heads probability 0.5, so on average half of the flips land heads. A biased coin has heads probability anywhere from 0 to 1. The coin flipper accepts any p, so fair coins, weighted tokens, and deliberately unfair flips are all handled by the same form.
Q: Can I use the coin flipper for a tiebreaker?
A: Yes. Set the number of flips to 1 and the heads probability to 0.5, leave the seed empty, and read the first character of the sequence. The flip is fair, fast, and reproducible if you enter a seed.
Q: How long is the longest streak I should expect from the coin flipper?
A: For a fair coin the expected longest heads run grows like log base 2 of n. For n = 10 flips the expected longest heads run is about 2.80, and for n = 100 flips it rises to about 5.01. Streaks longer than that are uncommon but not impossible.