
About D2
D2 is a declarative diagram language, and its tool turns plain text into diagrams. The syntax is short and readable, and the output can be styled with themes and a hand-drawn sketch mode.
What it does
You write a text file that lists shapes, containers, connections and labels, and D2 lays them out as a diagram. Layout engines such as ELK can be selected, and themes change the overall look. A playground in the browser lets you try the syntax before you install anything, and the examples page shows how common diagrams are written.
Key features
- Plain text syntax for shapes and links
- Nested containers for system layouts
- Several themes and a sketch mode
- Layout engine options such as ELK
- Browser playground for testing code
Who it's for
Engineers, architects and technical writers who want diagrams that live in version control next to the code they describe. It also suits teams that prefer writing code to dragging shapes in an editor.
Pricing and good to know
D2 is listed under the MPL-2.0 license, so the tool is free to use under those terms. It runs as a command-line program, and the playground runs in the browser. Diagrams are plain text files, so they diff well in version control, but very large diagrams can be harder to arrange by hand than in a visual editor.
Highlights
- Writes diagrams in short plain text syntax
- Nests containers to model systems
- Offers themes and a hand-drawn sketch mode
- Selects layout engines such as ELK
- Tests code in a browser playground












