D2 vs Mermaid
A data-driven comparison of two Diagrams as code: popularity, development activity, licensing and installation. Updated .
Declarative diagram scripting language that turns text into diagrams.
Generate diagrams and flowcharts from markdown-like text definitions, with a live editor.
Key differences
- Mermaid has 3.5× as many GitHub stars as D2 (90.5K vs 25.6K).
- Mermaid had more development activity over the last 12 months: 2,472 commits vs 324.
- D2 is licensed under MPL-2.0; Mermaid under MIT.
- D2 is written primarily in Go, Mermaid in TypeScript.
- Mermaid is the older project: its repository was created in 2014, D2's in 2022.
By the numbers
- D2
- Mermaid
Show data as a table
| Metric | D2 | Mermaid |
|---|---|---|
| GitHub stars | 25,564 | 90,531 |
| Commits, last 12 months | 324 | 2,472 |
| Contributors | 65 | 365 |
| Forks | 757 | 9,322 |
Development activity
Commits per month to each default branch, last 12 complete months.
- D2
- Mermaid
Show data as a table
| Month | D2 | Mermaid |
|---|---|---|
| Oct 2025 | 7 | 63 |
| Nov 2025 | 0 | 143 |
| Dec 2025 | 0 | 61 |
| Jan 2026 | 0 | 89 |
| Feb 2026 | 0 | 186 |
| Mar 2026 | 0 | 230 |
| Apr 2026 | 2 | 277 |
| May 2026 | 0 | 435 |
| Jun 2026 | 0 | 327 |
| Jul 2026 | 0 | 75 |
| Aug 2026 | 160 | 331 |
| Sep 2026 | 155 | 255 |
Side by side
| Attribute | D2 | Mermaid |
|---|---|---|
| Description | Declarative diagram scripting language that turns text into diagrams. | Generate diagrams and flowcharts from markdown-like text definitions, with a live editor. |
| Category | Diagrams as code | Diagrams as code |
| License | MPL-2.0 | MIT |
| Language | Go | TypeScript |
| Status | Active | Active |
| Latest release | v0.9.0 () | @mermaid-js/tiny@12.1.0 () |
| Last commit | ||
| Repository created | ||
| Open issues | 477 | 1,482 |
| Install | go get github.com/d2lang/d2 | npm install mermaid |
Which should you choose?
Popularity and activity are only part of the story. Consider which ecosystem you work in, the chart types and interactions you need, how much data you render, and whether the license fits your project. Both tool pages list alternatives if neither is quite right.
-
D2
Declarative diagram scripting language that turns text into diagrams.
-
Mermaid
Generate diagrams and flowcharts from markdown-like text definitions, with a live editor.