Ultra Calculator
    Games

    Dice Roller

    Choose how many dice to roll and how many sides each one has, and the calculator rolls them with your browser's random number generator. It lists every die's result and adds them up: two six-sided dice give two numbers from 1 to 6 and a total from 2 to 12.

    Last updated by Ultra Calculator

    Dice Roller

    How to calculate it

    roll = 1 + floor(r × s), total = roll 1 + roll 2 + … + roll n
    roll
    the number one die shows
    r
    a random fraction from 0 up to, but not including, 1, supplied by your browser
    s
    the number of sides on each die
    floor
    round down to a whole number
    n
    the number of dice
    total
    the sum of all the dice

    The total can be anything from n (every die shows 1) to n × s (every die shows its highest face). The average total over many rolls is n × (s + 1) ÷ 2.

    Worked example

    Two ordinary dice

    Two six-sided dice, as in many board games. Each die shows 1 to 6, the total is between 2 and 12, and over many rolls the total averages 7.

    You enter
    Number of dice2
    Sides on each die6
    The calculator returns
    Total9
    Each roll6, 3
    Possible totals2 to 12
    Average total over many rolls7

    How to use this calculator

    1. Enter the Number of dice to roll, from 1 to 100.
    2. Enter the Sides on each die: 6 for an ordinary die, or 4, 8, 10, 12, 20 or 100 for role-playing dice.
    3. Read the Total and Each roll in the results. Press Roll again to roll the same dice once more.
    4. Use Possible totals and Average total over many rolls to see how your roll compares with what to expect.

    Frequently asked questions

    How do I roll a d20 online?

    Set Number of dice to 1 and Sides on each die to 20. The result is a whole number from 1 to 20. The calculator gives each face the same share of the browser's random range, so in this model each has a 1 in 20 chance on every roll.

    What do 2d6 and 3d8 mean?

    That is dice notation. The number before the d is how many dice, and the number after it is how many sides each die has. 2d6 means two six-sided dice and 3d8 means three eight-sided dice, so enter those two numbers in the calculator.

    Can I roll dice with any number of sides?

    Yes, from 2 to 1,000 sides, including sizes that are rare or impossible as physical dice, such as 7 or 30. A 2-sided die works like a coin with faces numbered 1 and 2.

    Why do totals near the middle come up more often?

    With two fair six-sided dice there are 36 equally likely combinations. Six of them make 7, but only one makes 2 and only one makes 12. Adding more dice pulls the totals further towards the middle. The Dice Probability Calculator gives the exact chance of any total.

    Where do the rolls come from?

    Each die is rolled with your browser's Math.random function, a pseudo-random number generator. That suits games and lessons. MDN notes it is not cryptographically secure, so don't rely on it where money or security is at stake.

    Learn more

    Dice notation

    Games write dice as NdS: N dice with S sides each. 1d20 is one twenty-sided die, 4d6 is four six-sided dice. Some games add a number afterwards, as in 2d6 + 3, which means adding 3 to the total yourself.

    Why totals bunch in the middle

    The calculator treats every face of every die as equally likely, but totals are not. Two dice can make 7 in six ways (1 and 6, 2 and 5, 3 and 4, and the reverse of each) and 2 in only one way. The more dice you roll, the more the totals cluster around the average.

    The average total

    One die with s sides averages (s + 1) ÷ 2, so a six-sided die averages 3.5 and a d20 averages 10.5. Multiply by the number of dice for the average total: two six-sided dice average 7.

    • Playing a board game when the dice have gone missing
    • Rolling d4 to d100 for tabletop role-playing games
    • Rolling dozens of dice at once, which is slow to add up by hand
    • Teaching probability by comparing many rolls with the expected average
    • Making a quick random choice between up to six options with one die

    Swapping the two numbers in dice notation

    3d6 is three dice with six sides each, not six dice with three sides. Put the number before the d into Number of dice.

    Expecting every total to be equally likely

    With two or more dice, middle totals come up more often than the extremes. Only with a single die does each result get the same modelled chance.

    Thinking a number is due after a run without it

    Each roll is made fresh, so earlier rolls don't make any face more or less likely next time.

    Methodology and sources

    Each die is rolled separately with your browser's Math.random function, a pseudo-random generator that MDN describes as approximately uniform. The calculator turns each random fraction into a whole number from 1 to the number of sides by multiplying, rounding down and adding 1, then adds the dice together. Possible totals and the average come from the number of dice and sides, not from your roll: the average is the long-run mean, n × (s + 1) ÷ 2. Rolls are not weighted or adjusted. Math.random is not cryptographically secure, so don't use it for betting with real money or anything security-related.