Dice sum probability
With two six-sided dice, 7 comes up 6 ways out of 36, a 1 in 6 chance, while 2 and 12 each have just 1 in 36. Enter the number of dice and sides and get that exact table for every total. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- K
- 2
- S
- 6
- Total outcomes
- 36
- Min sum
- 2
- Max sum
- 12
- Mean
- 7
When you roll several fair dice and care about the total, every possible sum has its own exact probability. Two standard six-sided dice make seven more likely than two or twelve; three dice shift the mass toward the middle again; custom polyhedral dice change the range entirely. This calculator takes the number of dice k and the number of faces s on each die, expands the generating function (x + x² + … + x^s)^k with deterministic integer arithmetic, and returns the full probability mass function: ways, reduced fraction, and decimal probability for every reachable total from k through k·s. Values of k below one or s below two are rejected with a clear validation error so malformed game rules never produce a silent nonsense table.
What dice-sum probability means and why generating functions help
A single fair s-sided die shows each face from one through s with equal chance 1/s. When you roll k independent copies and add the faces, the sample space has size s^k equally likely outcomes. The sum ranges from the absolute minimum k (every die shows one) to the absolute maximum k·s (every die shows its highest face).
Intermediate totals are not equally likely: many different face combinations can produce the same middle sum, while the extreme totals have only a few microstates. The classical tool for counting those combinations is the generating function whose exponents track the sum and whose coefficients count the ways. One die contributes the polynomial x + x² + … + x^s.
Rolling k independent dice multiplies that polynomial by itself k times, so the coefficient of x^t in (x + x² + … + x^s)^k is exactly the number of ordered outcomes whose faces add to t. Divide that coefficient by s^k and you obtain the exact probability of total t. This is the same idea behind dice tables in tabletop RPGs, board-game balance sheets, and introductory discrete-probability courses.
It is also fully deterministic: given the same k and s, every correct implementation must produce the same ways, the same fractions, and the same ordered list of totals, which makes the distribution safe to pin in tests and teaching materials without Monte Carlo noise.
How this calculator expands the generating function
Call the capability with two required integers: k, the number of dice, and s, the number of faces on each die. The engine validates that k is an integer from one through forty and that s is an integer from two through one hundred. After validation, the core starts from the trivial generating function for zero dice (coefficient one at sum zero) and folds in one die at a time by convolving the current coefficient array with the face vector of length s.
Each convolution is exact BigInt arithmetic, so large way counts never round early. When all k dice have been folded in, the engine reads coefficients from sum k through sum k·s, checks that they add to s^k, reduces each ways/total fraction with a greatest-common-divisor step, and emits a stable floating probability for display.
What you can do with it
Tabletop and board-game balance
Designers compute exact odds for damage totals, skill checks, and multi-die pools on d6, d20, and custom faces without running thousands of simulated rolls.
Homework and discrete-probability labs
Students and graders verify the full sum distribution for k dice with s sides, including ways and reduced fractions, against hand-worked generating-function exercises.
Deterministic oracles for tests and tools
Interview platforms, rule engines, and CI suites call a stable oracle that rejects k below one or s below two and returns an identical PMF for identical inputs.
FAQ
How do I get the probability of every dice sum?
The response lists every reachable total with ways, reduced fraction, and probability.
What happens if k is below 1 or s is below 2?
At least one die and at least two faces are required; zero, negatives, and one-sided dice are rejected and not charged.
Which face numbering does this assume?
Each die shows faces 1 through s inclusive, the standard fair polyhedral model used in most probability textbooks and tabletop games.
Is the dice sum probability calculator free?
The browser tool runs free on your device.
Why generating functions instead of simulation?
Generating-function convolution counts every outcome exactly, so middle and rare totals are precise rather than approximate. The same (k, s) always returns the same table with no Monte Carlo noise.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/prob/dice-sum \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"k":2,"s":6}'const res = await fetch("https://api.kit.forhosting.com/prob/dice-sum", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"k": 2,
"s": 6
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/prob/dice-sum",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"k": 2,
"s": 6
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/prob/dice-sum", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"k":2,"s":6}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"k":2,"s":6}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/prob/dice-sum", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"k": 2,
"s": 6
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "prob.dice_sum",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_k | 40 |
max_s | 100 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
How this calculator expands the generating function
Missing fields, non-integers, k below one, s below two, and values above the published maxima all fail with invalid_input and are not charged. The response also reports total_outcomes, min_sum, max_sum, and the theoretical mean k·(s+1)/2 for a quick sanity check against the full table.
Practical use, limits, pricing, and delivery
Use the browser tool when you want an immediate exact distribution while designing a board game, checking a homework answer, or explaining why seven is the most common two-dice total without installing a computer-algebra package. There is no language model, no external probability service, and no randomness, so the capability is safe to pin in continuous-integration checks and reproducible lesson materials. Each successful request is one billable item at $0.002; failed validation does not consume balance. Accepted ranges keep the dynamic program bounded for Worker isolates: up to forty dice and one hundred faces still finish quickly while covering common polyhedral sets such as d4, d6, d8, d10, d12, and d20, including multi-die pools. Results are fully deterministic: the same k and s always yield the same total_outcomes, the same ordered distribution, and the same reduced fractions. Wire the endpoint into tabletop design tools, probability tutorials, coding-interview sandboxes, or game-balance pipelines where you already prefer exact generating-function counts over approximate simulation histograms that never quite settle.