By Tim King · Updated
Dice Roller
Roll D6, D20, D100 or Any Custom Die Online
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the Dice Roller works
This dice roller handles any die and any number of dice. Pick a die, choose how many to roll and press Generate. You get every individual roll, the total
with any modifier applied, and the highest and lowest face. The rolls come from the browser's
cryptographic random number generator, not Math.random(), so a D20 here is at least as fair as
the one in your bag. Nothing is recorded or sent anywhere.
Dice roller: choosing a name that fits
A physical die is fair when every face is equally likely, and the same test applies to a virtual one. Software dice fail that test in two ways: a poor source of randomness, and a biased way of turning that randomness into a face. This page avoids both, and here is exactly how.
Where the randomness comes from. JavaScript offers two random sources. Math.random() is a
pseudo-random generator seeded once when the page loads; in modern browsers it is xorshift128+,
which is fast and passes statistical tests but is not designed to be unpredictable. Someone who
sees a few hundred outputs can reconstruct its state and predict the rest. crypto.getRandomValues()
draws from the operating system's cryptographic generator, the same source used to make encryption
keys, which is continuously reseeded from hardware noise and cannot be predicted from previous
output. For a dice game between friends Math.random() would be fine; for anything where someone
might care about the outcome enough to cheat, it is not, and there is no cost to using the strong
source, so this page always does.
Turning random bits into a fair face. The generator gives 32 random bits, a number from 0 to 4,294,967,295. The naive way to get a D6 is to take that number modulo 6, but 4,294,967,296 is not divisible by 6, so the faces 1 through 4 each get one more chance than 5 and 6. The bias is tiny (about one part in a billion) but it is real, and for a D100 or a custom 37-sided die it grows. The fix is rejection sampling: discard any raw value in the leftover range at the top and draw again. This page does that, so every face has exactly the same probability whatever the die size.
Reading the results. The total is what most games want. The average per die is shown against the expected average, which is (sides + 1) ÷ 2, so 3.5 for a D6 and 10.5 for a D20; over a handful of rolls it will wander a long way from that, over a hundred it should be close. That is a useful reminder about how randomness feels: streaks of high or low rolls are normal, and a fair die produces them regularly. A D20 rolled on its own also flags a natural 20 or natural 1, since most tabletop systems treat those specially.
Modifiers and notation. The output uses standard dice notation: 2d6 + 3 means two six-sided dice plus three. The modifier is added once to the total, not to each die, which is how every mainstream tabletop system reads it. To roll several different dice at once, roll them separately; this page keeps to one die type per roll so the individual results stay readable.
Custom dice. Choose Custom and enter any number of sides from 2 upwards. A 2-sided die is a coin; a 3-sided one is what you get from a D6 divided by two and rounded up; anything else is whatever your game needs. Rejection sampling means an odd number of sides is exactly as fair as an even one.
FAQ
Is this dice roller truly random?
As random as a computer can be. It uses the browser's cryptographic generator, which is fed by hardware noise and is the same source used to create encryption keys, and it converts the output to faces without the modulo bias that simpler rollers have.
Why not just use Math.random()?
Because it is predictable in principle: it is a deterministic sequence from a seed, and its state can be reconstructed from a few hundred outputs. For a friendly game that does not matter, but using the cryptographic source costs nothing, so there is no reason to accept the weaker one.
Can I roll several different dice at once?
One die type per roll, as many of that die as you like up to 100. To roll 1d20 plus 2d6, roll them as two separate rolls; that also keeps the individual results readable so nobody has to argue about which die was which.
Does the modifier apply to each die or the total?
To the total, once. That matches the standard notation used by Dungeons & Dragons, Pathfinder and nearly every other tabletop system, where 3d6 + 2 means the sum of three dice with two added at the end.
Is anything logged?
No. Rolls happen in your browser and are not sent to a server or stored anywhere, which also means there is no roll history once you leave the page. Copy the result if you need a record of it.
See also: all Lists & Lines tools, Writing & Editing, Markdown & HTML, Ciphers & Alphabets.
Related tools
Random Team Generator
Split a list of names into random, evenly sized teams or groups.
UUID Generator
Random v4 or time-ordered v7 UUIDs, generated in your browser.
3D Coin Flip
Toss a physics coin in 3D and watch it land heads or tails.
3D Dice Roller
Throw physics dice in 3D, then read every face and the total.
Bingo Card Generator
Random 75-ball, 90-ball and word bingo cards, up to 50 at a time.