HandyTools Hub

🪙 Coin Flip

Flip a virtual coin — heads or tails, one click.

🔒 100% client-side — flips are never uploaded

👑
⭐

0
Heads · 0%
0
Tails · 0%
0
Total

A virtual coin is useful for the small decisions that stall a group: who pays, who goes first, which option to pick. This tool spins a 3D coin, reveals heads or tails, and keeps score automatically with heads/tails counts and live percentages. One-tap batches of 10, 100, or 1,000 flips let you watch the odds even out, and the tally is saved in your browser between visits.

How to Use

  1. Flip once: press the flip button and wait for the 900 ms spin. The coin lands showing the crown side for heads or the star side for tails.
  2. Read the tally: the heads, tails, and total counters update after each flip, along with the percentage of each side.
  3. Batch a series: click ×10, ×100, or ×1000 to add that many flips instantly. The animation is skipped and the counters jump to their new values.
  4. Reset: the reset button zeroes both counts and clears the saved tally.

Reading the Stats

The three counters show heads, tails, and total flips. Below each side’s count is its percentage, rounded to one decimal place, so 7 flips out of 10 reads as 70%. Percentages are meaningless at very small totals — one flip is always 100% of one side — so give a series at least a few dozen flips before drawing conclusions from the split. Because the tally is stored in localStorage, you can leave the tab, come back an hour later, and continue the same session; reset is the only thing that clears it. Closing or refreshing the tab does not stop the session: the counts return exactly as you left them until you reset.

The denominator matters more than any single number on screen. Early in a series the percentages swing wildly — two heads in a row reads as 100%, then a tails pulls it back to roughly 67%. By the time you have a few hundred flips, each additional flip moves the display by tenths of a percent, and a single result barely budges it. For a clean demonstration, run the ×1000 batch and read the split, then reset and run it again: two large trials will land close to 50/50 but will not produce identical results. The displayed percentages are rounded for reading only; the saved tally stores whole flip counts, so no rounding error accumulates across sessions.

What “Random” Actually Means Here

The pure logic module flips with rand() < 0.5, defaulting to Math.random. On the live page the component swaps in a crypto-backed function that reads one 32-bit unsigned integer from crypto.getRandomValues and divides it by 2^32, giving a uniformly distributed float in [0, 1). That is a solid source for a casual coin, but “random” is not the same as “certified.” The stream comes from a browser API with no published audit, so it should not be treated as a source of cryptographic entropy. If you copied the underlying function without the crypto replacement, you would be using the default Math.random, which is explicitly not suitable for security work. The 32-bit read offers about 4.3 billion possible values, so the heads/tails split is decided across roughly 2.1 billion values on each side — a granularity far finer than any everyday decision needs.

Worked Examples: What 1,000 Flips Looks Like

For a fair coin, the number of heads in n flips has a standard deviation of sqrt(n × 0.25). That gives a useful yardstick:

FlipsExpected headsStandard deviationTypical 95% range
1051.62–8
100505.040–60
1,00050015.8468–532

So if 1,000 bulk flips return 507 heads (50.7%), that is not a bias — it is about half a standard deviation from the mean. Only a result far outside the 95% range, or a persistent lean across many large batches, would suggest something other than chance.

Common Misconceptions

  • The coin is “due” for tails. It has no memory. After five heads, the next flip is still 50/50.
  • A 60/40 split on 20 flips proves bias. Small samples are noisy; that split is within one standard deviation.
  • Long streaks are impossible. A run of five or six heads in 100 flips is routine, not a malfunction.
  • Percentages should snap to 50.0%. They round to one decimal and will rarely sit exactly on 50.
  • Reset can be undone. It cannot. Clearing the tally discards the counts permanently; there is no history to restore.
  • A single result should be reproducible. Because the source is live randomness, running the same batch again will usually give a different split.

Practical Uses, and When to Skip It

Assign heads to one option and tails to the other to break a tie, decide a game’s first player, or stand in for a lost physical coin. In a classroom, the ×1000 button makes the law of large numbers tangible: the percentages drift toward 50 as the denominator grows. Psychologists also note that once the coin is in the air, your gut reaction to the outcome often reveals which choice you actually preferred. What you should not do is use this page for raffles with real prizes, regulated draws, or anything involving money or secrets — reach for a purpose-built random source instead. The tool is a decision aid, not an authority: if a group agrees in advance to honor the flip, fine, but the page keeps no audit trail or tamper-evident record, so settle the rules before anyone presses the button.

Frequently Asked Questions

Does the coin flip use Math.random or a cryptographically secure random source?

The logic module's default random source is Math.random, but the live page replaces it with crypto.getRandomValues, using a 32-bit unsigned integer divided by 2^32 to get a value in [0, 1). A result below 0.5 is heads; anything else is tails. Both are ordinary pseudo-random streams by the time they hit the coin, so treat the output as fair for casual use, not as an audited source of entropy.

Why doesn't 100 flips come out exactly 50/50?

Each flip is an independent 50/50 event, so a batch only approaches even odds as the number of flips grows. For 100 flips the standard deviation is about 5 heads (sqrt(100 × 0.25)), so a split anywhere from roughly 40/60 to 60/40 is perfectly normal. For 1,000 flips the standard deviation is about 15.8, which is why large batches cluster much closer to 50%.

Does the running tally persist across page reloads?

Yes. The heads, tails, and total counts are written to localStorage under the key coin-flip:tally after every flip and restored on the next visit. The Reset button zeroes the counts and overwrites the saved value. Nothing is ever sent to a server, and if storage is unavailable the tool simply keeps counting for the current session without persisting.

What is the largest batch of flips the tool can run at once?

The bulk buttons offer 10, 100, and 1,000 flips, while the underlying flipCoins function accepts any integer from 1 to 10,000. Batches are added to the running tally in a single step, so the counter jumps immediately rather than animating one flip at a time. There is no limit on how many batches you can run in a session.

Is this safe to use for gambling, lotteries, or generating passwords?

No. A virtual coin flip is fine for casual decisions and teaching probability, but it is not designed or certified for wagers, official draws, or cryptographic purposes. Browser random APIs can differ across devices, and the page's JavaScript is not an audited source of entropy. Use a dedicated, independently verified random number generator for anything with money or security at stake.

Why does the result take about a second to appear after I click?

The coin runs a fixed 900 ms 3D rotation animation before the result text and the tally update, so the reveal lines up with the landing frame. Bulk flips skip the animation entirely and update the counts instantly. Clicking the flip button again during the animation is ignored until the current spin finishes.

Reviewed by the HandyTools Hub team · Last updated