Expression Editor Reference

Use Dice Bench when you want a quick draft. Use Expression Editor to take advantage of the full power of the dice roll notation.

How to read an expression

The expression editor reads left to right like arithmetic. Declare dice groups, combine them with math operators, and add parentheses when you want to force evaluation order.

2d6 + 3

Roll dice, then add or subtract flat modifiers with normal arithmetic operators.

  • `+`, `-`, `*`, and `/` all work in the expression editor.
(1d8 + 4) * 2

Use parentheses to control order of operations before multiplying or dividing.

  • Parentheses are the clearest way to group damage formulas.
-2 + d20

Unary minus is supported, so penalties can be written inline.

  • Unary minus gets bound tighter than multiplication or division.

Supported dice types

The parser currently supports the core polyhedral dice, percentile dice, and fudge dice.

d4

Single four-sided die.

d6

Single six-sided die.

d8

Single eight-sided die.

d10

Single ten-sided die.

  • `d10` rolls from `1` to `10` instead of `0` to `9`
d12

Single twelve-sided die.

d20

Single twenty-sided die.

d%

Percentile die.

  • `d%` rolls from `1` to `100`.
4dF

Fudge/Fate dice.

  • Fudge dice roll from `-1` to `1`.

Single-d20 shorthand

Advantage and disadvantage are special d20 syntax, not general-purpose suffixes for every die.

d20adv

Roll advantage on a single d20.

  • Advantage only works on a single `d20` term.
d20dis

Roll disadvantage on a single d20.

  • Disadvantage only works on a single `d20` term.

Roll modifiers

Most advanced modifiers get combined with dice rolls. Modifiers can be stacked in one expression.

4d6kh3

Keep the highest three dice.

  • Use `kh`, `kl`, or threshold forms like `k>=12`.
4d6dl2

Drop the lowest two dice.

  • Use `dh`, `dl`, or threshold forms like `d>=5`.
2d6r<=2

Reroll matching dice until they miss the condition.

  • Add `times2` to cap rerolls: `2d6r<=2times2`.
1d6ex

Explode maximum dice roll

  • Roll another dice whenever a dice falls on its highest value
4d6c>=5

Count how many kept dice meet a target.

  • Bare `c` counts how many kept dice remain.
3d6sa

Sort rolls ascending for cleaner readouts.

  • Use `s` for descending sort, `sa` for ascending.
3d6min2max5

Clamp each die between a minimum and maximum result.

  • `minN` and `maxN` apply after rolling.
6d6u

Force all kept dice to be unique by rerolling duplicates.

  • `u` is exclusive and cannot be combined with other modifiers.

Combination recipes

These examples show how to combine arithmetic, multiple dice groups, and stacked modifiers into one command.

d20adv + 5

Advantage attack roll with a flat bonus.

  • Useful when the table already knows the modifier.
2d6 + 1d8 + 4

Combine multiple dice groups in one expression.

  • Each term is rolled independently and then added together.
1d8ex>=4times2

Use parameters like <=5`, `=10`, `times3` to chance default behavior of modifiers.

  • Most modifiers can be set to trigger on certan dice rolls or be capped to trigger a max number of times.
4d6r<=3times2kh2d>=5c>=6smin2max5

Stack rerolls, keep/drop logic, counting, sorting, and clamps in one expression.

What to watch for

The editor is flexible, but a few modifiers have important limits and exclusivity rules.

d20adv

Advantage/disadvantage are special d20 shortcuts, not generic modifiers.

  • `2d20adv` and `d6adv` are rejected bt the parser.
6d6u

Unique rolls are valid, but `u` cannot be combined with keep/drop/reroll/explode modifiers.

  • If you need both uniqueness and other logic, split the roll into separate expressions.
1d6ex>=1times2

Use `timesN` when a reroll or explosion condition could loop too long.

  • The parser rejects impossible infinite conditions unless you cap them.