
Terrastruct
D2
Write code
Open-source diagram language from Terrastruct: you write declarative D2 text and the CLI renders it; the paid D2 Studio editor is shutting down at the end of 2026.
- How you draw
- Code
- Free for work
- Yes
- Open source
- Paid from
- Free
- Open source
- Exports
- SVG, PNG, PDF
- Runs on
- Web, Windows, Mac, Linux
- Works offline
- Made by
- Terrastruct
- United States
Good to know
- The free version can be used for work
- Works fully offline
- Open source (MPL-2.0)
- Diagrams as code: D2
Where it stands among 24
Each fact with every app's answer. D2 is outlined.
Main way to draw
Write code
Sketch by hand 5
Drag shapes 13
Write code 4
Describe in words 2
Free for work use
Free version allows work use
Free version allows work use 10
Exports SVG
On every plan
On every plan 15
On paid plans 5
Draws from a text prompt
Not stated
On every plan 14
On paid plans 3
No AI drawing 1
Not stated 6
Diagram code
D2
Works offline
Fully offline
Open source
Open source
Plans and prices
In USD, per month, as listed by Terrastruct. Checked 17 October 2026.
| Plan | Billed yearly | Billed monthly | Seats | Notes |
|---|---|---|---|---|
| Free | Free and open sourceUnlimited with the open-source CLI | Work use: allowed | ||
| D2 Studio | Not stated | Not stated | Not stated | Paid monthly or annually after a free trial; shutting down at the end of 2026. |
- Free for work use
- YesYes
- One-time licence
- Not stated
- Enterprise
- Price on request
How you make a diagram
- Ways to draw
- Code
- AI from a text prompt
- Not statedNot stated Not stated
- AI limits
- Not applicable No AI features stated
- Diagram code
- D2 Declarative D2 language; D2 Studio added two-way text and GUI editing
- Diagram types
- UML, Sequence, Cloud architecture General technical diagrams; curated icon set
What you get out
- SVG
- YesYes Default CLI output
- PNG
- YesYes
- YesYes
- Visio (VSDX)
- Not statedNot stated Not stated
- Watermark on free exports
- NoNo Open-source CLI output
- Imports
- None No diagram file import stated
Where it runs and where files live
- Apps
- Web, Windows, Mac, Linux
- Works offline
- YesYes The CLI works fully offline
- Open source
- YesYes The D2 language and CLI; D2 Studio isn't
- Self-hosting
- Paid plansPaid plans Enterprise self-hosted D2 Studio; the CLI runs anywhere
- Where diagrams are stored
- Files on your device, GitHub, Maker's cloud Local .d2 files; D2 Studio on Google Cloud with GitHub sync
- Works inside
- GitHub, Confluence, Slack, VS Code, Jira Through Terrastruct plugins and its Atlassian integration
- Live co-editing
- Not statedNot stated Not stated
- API
- YesYes D2 Language API for creating diagrams in code
Who you're trusting
- Company
- Terrastruct, Inc.
- Owned by
- Not stated No parent company stated
- Based in
- United States San Francisco address
- Launched
- 2022 D2 was open-sourced in November 2022
- Security reports
- SOC 2 Type not stated
- Single sign-on
- Not stated The run reported SSO on Enterprise; not in the cited excerpt
- Data residency
- Not stated None stated