ForHosting KIT · Math

Dice expected value and variance

One fair six-sided die has an expected value of 3.5 and a variance of 35/12. Enter the sides and the number of rolls to get both figures for the sum: how large the total tends to be and how much it wanders. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Sides
6
Rolls
1
You get
Expected value
3.5
Variance
2.9166666667
Standard deviation
1.7078251277
Single die expected value
3.5

A fair die with a known number of faces is one of the cleanest discrete random variables in probability: each integer from one through the number of sides is equally likely, and independent rolls add without covariance. Students, game designers, and analysts often need the expected value and the variance of that experiment—not the chance of a particular total, and not a simulated face. This calculator accepts the number of sides and the number of independent rolls, then returns both statistics for the sum using the closed formulas expected value equals rolls times sides plus one over two, and variance equals rolls times sides squared minus one over twelve.

What expected value and variance mean for a fair die

Expected value is the long-run average of the sum if you repeated the same experiment forever. For one fair die with faces one through sides, that average is exactly the midpoint of the first and last face: sides plus one, divided by two. A standard six-sided die therefore has expected value three and a half, a four-sided die has two and a half, and a twenty-sided die has ten and a half.

Variance measures how widely the sum spreads around that average. Because the faces form an arithmetic sequence of integers, the one-die variance collapses to a compact identity: sides squared minus one, all over twelve. One d6 therefore has variance thirty-five twelfths; a degenerate one-sided die has variance zero, which is honest rather than a special case.

When you roll the same fair die several independent times and add the faces, linearity of expectation multiplies the mean by the number of rolls, and independence multiplies the variance by the same count. Two standard six-siders therefore have expected sum seven and variance thirty-five sixths. Those two numbers are the contract of this capability: they answer how large the total tends to be and how much it typically wanders, without enumerating every tuple or sampling random faces.

They are not a probability table for a chosen target, not a minimum-to-maximum range, and not a seeded roller. If you need the chance that the sum equals seven, use a dice-sum probability tool; if you need a simulated face, use a roller. Here the question is only the pair of moments, computed in closed form so the answer is exact in ordinary floating arithmetic and identical every time you ask.

Where dice moments earn their keep in study, play, and software

Classrooms use expected value and variance of a fair die to introduce discrete moments before binomial or normal models. A student who can derive three and a half and thirty-five twelfths for a d6 is ready to add independent copies and see why two dice centre on seven with a wider spread. Exam generators need a deterministic oracle that rejects a zero-sided die instead of silently returning NaN that a buggy grader might treat as success.

Game designers compare polyhedral sets by their means and variances when balancing damage tracks, resource tables, or skill checks: a 3d6 attack and a 1d20 attack are not interchangeable just because both can print numbers in a similar band. Simulation authors validate Monte Carlo code against the closed form on small cases before trusting a long random run.

Keep the two integers small, pin the echoed moments in tests, and you get reproducible statistics for homework, virtual tabletops, and edge workers without re-deriving the arithmetic sequence identities each time a new die size appears in a ruleset.

Classroom and homework checks

Verify the mean and variance of a fair n-sided die, or of n independent rolls, against the closed identities used in introductory probability.

Game design and tabletop balance

Compare polyhedral pools by expected sum and spread when tuning damage tracks, skill checks, or resource tables.

How do I compute the expected value and variance of a fair die?

Send positive integers sides (faces 1 through sides) and rolls (independent copies).

Is the result for one roll or for the sum of several rolls?

Both statistics are for the sum of the independent rolls. One roll is the one-die case. The response also echoes the one-die moments so you can compare them without a second call.

What happens if sides or rolls is not a positive integer?

Zero, negatives, fractions, and missing values are rejected and are not billed.

Does this return the probability of a particular sum?

No. It returns expected value and variance only. For the chance that the faces add to a chosen target, use a dice-sum probability calculator.

What is the expected total of two six-sided dice?

Seven, with a variance of 35/6. Because the rolls are independent, both the mean and the variance of one die, 3.5 and 35/12, are simply multiplied by the number of rolls.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/stat/dice

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/stat/dice \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sides":6,"rolls":1}'
{
  "sides": 6,
  "rolls": 1
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.dice",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_sides1000000
max_rolls1000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Failed validation is not billed; a successful call costs $0.002.

Input contract, response shape, and error behaviour

Send two required positive integers. Both must be whole numbers of at least one and at most one million. Classic checks include one six-sided die (mean three and a half, variance thirty-five twelfths) and two six-sided dice (mean seven, variance thirty-five sixths). The implementation is a handful of multiplies: there is no dynamic-programming table, no Monte Carlo draw, no Date, and no network. The field sides is the number of faces on each fair die, numbered from one upward; aliases s, faces, and faces_per_die are accepted so spreadsheets and typed forms can reuse the same contract. The field rolls is how many independent times that die is rolled; aliases n, times, count, and dice are accepted. Missing fields, empty strings, fractions, scientific notation, zero, and negatives fail with invalid_input and name the offending field. Those failures are not billed. On success the body echoes the validated sides and rolls, then returns expected_value and variance for the sum, plus standard_deviation as the square root of that variance, the one-die moments single_die_expected_value and single_die_variance, the reachable band min_sum equals rolls and max_sum equals rolls times sides, and a short formula string restating the two identities. Pair the free browser run on this page with the priced API when you need the identical pair of statistics inside an automated pipeline. Each successful lookup costs $0.002; keep requests inside the published ceilings and you get reproducible moments without standing up a computer-algebra system of your own.

Where dice moments earn their keep in study, play, and software

Finance and decision notebooks sometimes reduce a discrete uniform payoff to the same identities; calling a tiny parse endpoint avoids pulling a full statistics library for two integers.

Simulation and fixture validation

Assert Monte Carlo or engine dice code against exact moments for 1d6, 2d6, and custom faces before trusting a long random run.

What does the dice expected-value calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →