DiceDecide

How to Test Whether a Die Is Fair Using a Chi-Square Test

Be the first to rate this page.

A chi-square goodness-of-fit test sums (observed − expected)² ÷ expected across all six faces of a die; for a genuinely fair die rolled honestly, that total stays below 11.070 about 95% of the time, which is the specific threshold a real fairness test checks against rather than a single face that happens to look high.

A worked example with numbers

The formula has five degrees of freedom for a six-sided die, one less than the number of faces, because once five face counts and the total roll count are known, the sixth count is fixed. Suppose 60 rolls of a die produce the counts 6, 8, 15, 9, 12, and 10 for faces one through six. The expected count under a fair die is 60 ÷ 6 = 10 for every face. Summing (6−10)²/10 + (8−10)²/10 + (15−10)²/10 + (9−10)²/10 + (12−10)²/10 + (10−10)²/10 gives a chi-square statistic of exactly 5.0. That result sits comfortably below the 11.070 threshold for five degrees of freedom at the standard 95% confidence level, so the test does not reject fairness — even though the face showing 15 looks, at a glance, like it might be loaded.

How to set the rule before the result

To run this test on a real die, roll it — or use the roll a die tool or a physically built custom dice roller to generate a comparison sequence — and record how many times each face lands, keeping the six counts separate rather than only tracking a running total. NIST’s statistical handbook recommends the chi-square approximation only when every expected bin count is at least 5, which for six equally likely faces means at least 30 total rolls; more rolls make the test more sensitive to small biases, not just more accurate. Once the counts are collected, compute the same (observed−expected)²/expected sum used above and compare it against the table for five degrees of freedom, choosing the confidence level — 90%, 95%, or 99% — before looking at the result, not after.

Common mistakes that change the odds or the process

The most common mistake is judging one face in isolation — “face six came up 15 times, that seems like a lot” — instead of running the joint test across all six counts together, which is exactly the multiple-comparisons problem the chi-square statistic is built to avoid. A second mistake is running the test on too few rolls: below 30 rolls, several expected bin counts fall under 5 and the chi-square approximation itself becomes unreliable, regardless of what the resulting number says. A third mistake is treating a passing result as proof the die is fair forever, when it only describes the sample actually rolled; a die that starts out fair can still wear unevenly over years of use. A fourth mistake is re-rolling and re-testing repeatedly until a passing result appears, then reporting only that one test — the correct sample is the first one collected under a stated rule, not the one that happens to confirm the desired answer.

Where this method stops being appropriate

This test only evaluates whether the six long-run face probabilities are equal; it says nothing about a single session’s luck, about a die whose physical shape is uneven in a way that does not yet show up in the recorded rolls, or about a die that is deliberately unequal by design, such as a loaded novelty die sold as such. It also assumes every roll is independent and identically distributed — a die that is re-weighted, swapped, or handled differently partway through data collection breaks that assumption and invalidates the test. And it cannot distinguish an honestly rolled biased die from a fair die whose rolls were recorded or reported dishonestly; the arithmetic only ever describes the numbers it is given. The same faces-minus-one rule scales to any die size: a d4 has df = 3 with a 95%-confidence critical value of about 7.815, while a d20 has df = 19 and a critical value of about 30.144 — a larger die needs a proportionally larger chi-square statistic before a deviation counts as meaningful, since more independent face counts have more room to drift apart by chance alone.

How the random source fits into the rule

NIST’s Engineering Statistics Handbook chi-square goodness-of-fit test documents the chi-square goodness-of-fit statistic, its degrees-of-freedom rule, and the minimum-expected-count guidance used above; Wolfram MathWorld’s dice reference documents the equal-probability assumption a fair die is defined by, which is exactly the null hypothesis this test checks.

The chi-square critical-value table for a six-sided die

Confidence levelSignificance (α)Critical value (df = 5)
90%0.109.236
95%0.0511.070
99%0.0115.086

A chi-square statistic below the chosen row’s critical value means the observed counts are consistent with a fair die at that confidence level; a statistic above it means the deviation is unlikely to be ordinary variation. Choosing 99% confidence over 95% makes the test stricter — it takes a larger deviation to fail — which is the standard trade-off between missing a real bias and flagging a fair die by mistake.

A second case: 600 rolls that clearly fail the test

Suppose a die is rolled 600 times instead of 60, with counts of 80, 95, 90, 85, 100, and 150 across the six faces. The expected count per face is 600 ÷ 6 = 100, and summing (80−100)²/100 + (95−100)²/100 + (90−100)²/100 + (85−100)²/100 + (100−100)²/100 + (150−100)²/100 gives a chi-square statistic of 32.5 — far above even the 99%-confidence threshold of 15.086. Face six landing 150 times against an expected 100 is the obvious driver, but the test’s value is that it reaches this conclusion from the whole distribution at once, using a rule set before the data was seen, rather than from a single face count that happens to stand out.

Why checking each face separately goes wrong, and how much data actually helps

Testing each of the six faces on its own, at a 95% confidence level per face, might look like a reasonable shortcut — but running six separate tests instead of one joint test raises the chance that at least one comes back “significant” purely by luck to 1 − 0.95⁶ ≈ 26.49%, more than one in four, even when the die is perfectly fair. The single chi-square statistic used above avoids this problem because it is one test with one significance level, not six tests dressed up as one conclusion.

Detecting a large bias is easy; detecting a small one takes far more data. Using the same 95%-confidence sample-size arithmetic applied elsewhere on this site to a single face’s proportion, catching a face that is off by 5 percentage points — landing at about 21.67% instead of the fair 16.67% — needs roughly n = 1.96² × (1/6)(5/6) ÷ 0.05² ≈ 213 rolls. Catching a much subtler 2-percentage-point bias needs roughly n = 1.96² × (1/6)(5/6) ÷ 0.02² ≈ 1,334 rolls. A home test of a few dozen rolls can reliably catch a die that is dramatically loaded, but it has no realistic chance of catching one that is only mildly unfair.

Related DiceDecide tools

Enter your values, review the result, then use it with confidence.

Rate this page

Be the first to rate this page.