Roll dice anywhere.
Show the work.
Every die drawn from a CSPRNG, and a transparent report of how they were processed — not just the total. Available as an npm package, or via a hosted API for everything that is not JavaScript.
npm i opendiceEverything a dice roll should tell you.
The package and the API return the same shape, so what you learn in one applies to the other.
It shows its work
results holds every die rolled and keptFlags says which ones counted, so an interface can dim the die advantage dropped rather than hide it.
Auditable randomness
One draw per die from crypto.getRandomValues, with rejection sampling so no face is likelier than another. No streak-breaking, no feels-fair fudging.
A grammar, not a number
Advantage, keep highest and lowest, exploding, penetrating, group multipliers and tags. Terms combine freely, and a typo is an error rather than a guess.
No game system attached
It knows what 4d6kh3 means and nothing about what you use it for. No rules, no opinions, no judgment.
Zero dependencies, typed
The package pulls in nothing, ships its own types and source maps, and runs in browsers, Node and edge runtimes alike.
Free and unauthenticated
No key, no signup, no account. Bounded by published limits so it stays up, and documented by an OpenAPI 3.1 document you can generate a client from.
Two ways to roll
The dice logic is an npm package. Rollful hosts it, which matters when the roll cannot happen on the client.
In JavaScript, use the package
No network call, no rate limit, no dependency on this service staying up. Everything runs in the browser.
import { roll } from 'opendice'
const result = roll('4d6kh3')
result.total // 14result.dice[0].results // [5, 4, 5, 3]result.dice[0].kept // [5, 5, 4]Anywhere else, call the API
A server-authoritative roll, a result several people must agree on, or a language with no OpenDice build.
curl 'https://api.rollful.dev/v1/roll?formula=4d6kh3'{ "total": 14, "dice": [{ "results": [5, 4, 5, 3], "keptFlags": [true, true, true, false] }]}