Parse D&D dice notation
2d6+3 means two six-sided dice plus 3: the total ranges from 5 to 15 and averages 10. Type one dice expression such as d20-1 or 4d8 to see the dice count, sides, modifier, minimum, maximum and average. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Notation
- 2d6+3
- Quantity
- 2
- Sides
- 6
- Modifier
- 3
- Min
- 5
Turn compact tabletop dice expressions into structured, dependable data. This D&D dice notation parser accepts forms such as 2d6+3, d20-1, and 4D8, then returns the number of dice, sides per die, signed modifier, minimum possible result, maximum possible result, and mathematical average. It normalizes harmless spacing and capitalization while rejecting incomplete, ambiguous, or unsafe values. The calculation is deterministic and runs without random rolls, network access, or changing data. Use the browser tool while preparing a campaign, checking a character sheet, or debugging a virtual tabletop integration.
How to write supported dice notation
Enter one dice expression in the familiar NdS format. N is the number of dice, d separates the two values, and S is the number of sides on every die. For example, 2d6 means two six-sided dice, while 4d8+5 means four eight-sided dice with five added after the roll.
The separator may be an uppercase or lowercase d. You may omit the count when rolling one die, so d20 is normalized to 1d20. An optional modifier must use a plus or minus sign followed by a whole number, as in 3d10-2.
Spaces may appear around the components because they are removed before parsing; 2 d 6 + 3 therefore has the same meaning as 2d6+3. The parser deliberately accepts one expression only. It does not evaluate dice pools joined by commas, arithmetic such as 2d6+1d4, keep-highest syntax, exploding dice markers, percentages, decimals, or descriptive text.
If a particular game uses advanced roll operators, parse its basic terms separately and apply that game’s additional rules in a purpose-built layer.
Understanding the parsed fields and roll statistics
The response includes notation, count, sides, modifier, min, max, and average. Notation is a canonical representation: the separator becomes lowercase, an omitted count becomes one, unnecessary whitespace disappears, and a zero modifier is omitted. Count and sides directly describe the dice pool.
Modifier is always numeric, with zero returned when no modifier was written. The minimum assumes that every die shows one, so it equals count plus modifier. The maximum assumes that every die shows its highest face, so it equals count multiplied by sides, plus modifier.
The average uses the expected value of a fair die, which is sides plus one divided by two, multiplies it by count, and finally adds the modifier. Thus 2d6+3 has a minimum of 5, a maximum of 15, and an average of 10. These figures describe possible totals before any game-specific effects such as critical hits, rerolls, advantage, exploding dice, or minimum-damage rules.
Average is an expectation over many independent fair rolls; it does not promise that a single roll will equal that value, and for some expressions it is a half-step that no individual integer roll can produce. Because the parser performs arithmetic rather than simulation, repeated calls with the same input always return exactly the same structure and values.
Validation patterns for game tools and automated workflows
Use this parser at the boundary where human-friendly notation enters structured software. A character-sheet editor can accept a weapon’s 1d8+4 damage string, parse it once, and display a range preview before saving the canonical notation. A rules reference can calculate compact min, max, and average summaries without rolling dice or implementing a second notation grammar.
Treat a successful result as a syntactic and arithmetic interpretation, not as proof that the expression is permitted by a particular ruleset. The parser allows any positive safe integer for count and sides when the derived range remains safe, including unusual dice such as d3 or 7d1. Your application may add tighter limits or an approved set of physical die sizes after parsing.
On errors, show the returned message and preserve the original user entry so it can be corrected; do not silently substitute a default die. If you store the value, the canonical notation is useful for deduplication while the numeric fields support sorting and filtering. Both paths use the same deterministic algorithm, so interactive previews and backend validation remain aligned across campaign tools, game databases, content pipelines, and automated tests.
What you can do with it
Character sheet validation
Convert weapon, spell, and healing expressions into structured fields before saving a character sheet.
Game design documentation
Generate minimum, maximum, and average values for compact dice expressions without simulating rolls.
FAQ
What dice notation is supported?
Use NdS with an optional signed whole-number modifier, such as 2d6, d20+5, or 3D8-2.
Can I omit the dice count?
Yes. An expression such as d20 is accepted and normalized to 1d20.
How are minimum, maximum, and average calculated?
Minimum is count plus modifier, maximum is count times sides plus modifier, and average is count times (sides + 1) / 2 plus modifier.
Does this parser roll the dice?
No. It parses and analyzes the expression deterministically; it never generates a random roll.
Can it read 2d6+1d4 or keep-highest rolls?
No. It reads one expression at a time, such as 2d6+3 or d20-1. Combined pools, keep-highest, exploding dice, percentages and decimals are not accepted; read each basic part separately and apply your game's extra rules afterward.
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/game/dnd-dice-notation-parse \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"notation":"2d6+3"}'const res = await fetch("https://api.kit.forhosting.com/game/dnd-dice-notation-parse", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"notation": "2d6+3"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/game/dnd-dice-notation-parse",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"notation": "2d6+3"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/game/dnd-dice-notation-parse", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"notation":"2d6+3"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"notation":"2d6+3"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/game/dnd-dice-notation-parse", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"notation": "2d6+3"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "game.dnd_dice_notation_parse",
"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.
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
For automated workflows, the same parser is available through the API at $0.002 per successful request.
How to write supported dice notation
A missing side count, zero dice, zero-sided die, doubled sign, trailing characters, or number beyond JavaScript safe-integer limits produces an invalid_input error instead of a partial interpretation. This narrow grammar makes the returned fields predictable for forms, scripts, character builders, and stored game data.
Validation patterns for game tools and automated workflows
A virtual tabletop importer can validate fields from a spreadsheet and route invalid_input responses back to the exact rows that need correction. Browser use is free, and API processing costs $0.002 for each successful request.
Integration use cases
Virtual tabletop imports
Validate dice strings from JSON or spreadsheet imports and calculate consistent range previews.
Technical questions
What does the API cost?
A successful API request costs $0.002. The interactive browser version is free, and malformed input returns invalid_input.