Dice Roller
Roll dice of any side count, including D&D-style polyhedral dice.
About the Dice Roller
The Dice Roller simulates polyhedral dice rolls for tabletop role-playing games (TTRPGs) like Dungeons & Dragons, Pathfinder, Call of Cthulhu, and Shadowrun. Choose the number of dice (1-100), the type (d4, d6, d8, d10, d12, d20, or d100), a modifier (positive or negative), and optional exploding dice behavior, then click roll to get individual results, sum, average, min/max, and full dice notation like 2d20+5.
The standard polyhedral set covers every common TTRPG need: d4 for small-damage weapons and ability score progression, d6 for standard dice and many skill checks, d8 for medium weapons, d10 for percentile rolls (two d10s — one for tens, one for ones), d12 for large weapons, d20 for attack rolls and saving throws (the iconic D&D die), and d100 (also written d%) for percentile tables used in random encounter generation and treasure rolls.
The exploding dice option is popular in systems like Savage Worlds, Shadowrun, and Hackmaster: when a die rolls its maximum value (e.g., a 6 on a d6), it's rolled again and the new result is added. This continues as long as max values keep appearing, allowing theoretically infinite results but typically resolving in 1-2 extra rolls per die.
How It Works
Each die roll is computed as Math.floor(Math.random() × sides) + 1. This produces a uniform integer from 1 to sides inclusive. The +1 is necessary because Math.random() returns a value in [0, 1) — without it, the result would range from 0 to sides-1.
The modifier is added to the sum after all rolls complete. Positive modifiers represent bonuses (e.g., a +5 attack bonus in D&D); negative modifiers represent penalties. The total is sum(rolls) + modifier.
Exploding dice trigger when a roll equals the maximum value (the number of sides). The triggered roll adds a new die roll to the result, and if that new roll is also maximum, another is added, and so on. The current implementation caps at 50 explosions per die to prevent infinite loops in the unlikely event of a buggy PRNG. In practice, explosions rarely chain more than 2-3 times.
The dice notation output follows the standard TTRPG format: NdS[+M][!], where N is the number of dice, S is the sides, M is the modifier (with sign), and ! indicates exploding. So 3d6+2 means roll 3 six-sided dice and add 2; 1d20! means roll 1 twenty-sided die with explosions on 20s. This notation is recognized by most virtual tabletop platforms including Roll20 and Foundry.
Math.random() is a PRNG, not a true random source. For casual play this is fine; for tournaments or gambling applications, a true random source (atmospheric noise, radioactive decay) would be needed. The statistical distribution is uniform across all face values, matching a fair physical die.
Worked Examples
Default roll: 2d6 with no modifier. Each die produces 1-6 uniformly, sum ranges from 2 to 12. The most common sum is 7 (16.67% probability), following the classic triangular distribution. Two dice showing [4, 3] sum to 7, a perfectly average roll.
D&D attack roll: 1d20+5. Roll the d20 (1-20), add +5 attack bonus. A natural 20 is a critical hit (auto-hit and double damage in most systems); a natural 1 is a critical failure. With +5, you hit AC 15 on a roll of 10+ (55% chance).
Damage roll: 2d6+3 (greatsword with strength bonus). Two d6s produce 2-12 (most likely 7), plus 3 = 5-15 (most likely 10). This is why greatswords outperform great axes (1d12) on average — 2d6 averages 7, while 1d12 averages 6.5.
Percentile roll (d100): single die rolled for treasure tables, random encounters, and fate checks. Rolling 1d100 with no modifier gives 1-100 uniformly — a result of 100 on a treasure table might mean maximum loot; a 1 might mean a cursed item.
Exploding d6: roll 2d6! for a Savage Worlds damage roll. If either die shows a 6, roll it again and add. With two dice, expected explosions are 1 in 3 rolls. A sample sequence: [4, 6, 5] = 15 (the 6 triggered an extra 5).
When to Use This Tool
- Playing TTRPGs online without physical dice, or when you forgot your dice bag.
- Quickly resolving large dice pools (e.g., 10d6 fireball damage) without manually rolling and counting.
- Testing TTRPG character builds by simulating typical attack and damage rolls.
- Resolving percentile tables for random encounters, treasure, or random events.
- Demonstrating probability concepts (central limit theorem via many d6s, expected value of various dice sizes).
- Playing board games that require dice when physical dice are missing or unfair (worn corners).
- Generating random numbers for game design playtesting (e.g., simulating combat outcomes for balance testing).
Limitations & Disclaimer
This roller uses Math.random(), a non-cryptographic pseudorandom number generator. It's statistically uniform but not suitable for gambling, casino simulations, or any application requiring provable randomness. The tool does not support advantage/disadvantage rolls, mixed dice pools (e.g., 1d20+2d6), fudge dice (dF), or custom-sided dice. Exploding dice are capped at 50 explosions per die to prevent runaway loops. The maximum dice count is 100 per roll for performance. For TTRPG play with strict mathematical accuracy, results may deviate from expected values over small samples — the law of large numbers only guarantees convergence over thousands of rolls. See our disclaimer for full terms.
Frequently Asked Questions
Are the dice rolls truly random?
They use <code>Math.random()</code>, a pseudorandom number generator. The distribution is statistically uniform (each face has equal probability over many rolls), but the sequence is deterministic given the seed. For casual TTRPG play this is more than sufficient. For gambling or tournaments, use a crypto-secure source.
Can I roll with advantage or disadvantage?
Not directly in this version. D&D 5e advantage/disadvantage rolls 2d20 and keeps the higher (advantage) or lower (disadvantage). You can simulate by rolling 2d20 and applying the rule manually, or by rolling twice and using the appropriate result.
What does exploding dice mean?
When a die rolls its maximum value (e.g., 6 on a d6, 20 on a d20), it ‘explodes’ — you roll it again and add the result. This continues as long as you keep rolling max values. Common in Savage Worlds, Hackmaster, and some indie TTRPGs.
Why does the average not match the expected value?
The expected value of a single dN is (N+1)/2 (so 3.5 for d6, 10.5 for d20). With small numbers of rolls (1-5 dice), the actual average will deviate from this expected value due to variance. Over thousands of rolls, the average will converge to the expected value (law of large numbers).
Can I roll multiple dice types at once?
Not in this version. To roll, say, 1d20 + 2d6 + 3, you'd roll 1d20 (with modifier +3), then 2d6 separately, and add manually. A future version may support mixed dice pool notation like <code>1d20+2d6+3</code>.
Is there a way to seed the roll for reproducibility?
No. <code>Math.random()</code> uses an internal seed you can't control. For reproducible rolls (e.g., for playtesting or shared game replays), use a deterministic PRNG library like <code>seedrandom</code> with a known seed.
Last updated: July 21, 2026 · Author: HT99 Tools Editorial Team · Reviewed by: HT99 Tools Editorial Team