---
title: "7 tools that turn text into diagrams"
slug: "text-to-diagram"
description: "Write diagrams as text and render them as SVG: 7 open-source tools, from Mermaid and D2 to Kroki, one API for 20+ diagram languages."
published: "2026-11-11"
verifiedAt: "2026-11-20"
picks: 7
canonical: "https://aifree.dev/best/text-to-diagram"
---

# 7 tools that turn text into diagrams

> Write diagrams as text and render them as SVG: 7 open-source tools, from Mermaid and D2 to Kroki, one API for 20+ diagram languages.

Published 2026-11-11. Last checked 2026-11-20.

Diagrams go stale because editing them means dragging boxes. Write them as text next to the code they document (Claude can draft it), and these seven tools turn the text into pictures.

Every pick pushed a commit in the last 90 days (checked 2026-11-20) and has an install path from its own docs.

## The 7 tools at a glance

| Tool | What it does | Price | Install |
| --- | --- | --- | --- |
| Mermaid | Markdown-style markup, renders in GitHub | Free · OSS (MIT) | `npm install mermaid` |
| D2 | Modern diagram-as-code with a CLI | Free · OSS (MPL-2.0) | `curl -fsSL https://d2lang.com/install.sh \| sh -s --` |
| PlantUML | The UML veteran, 20+ diagram types | Free · OSS (LGPL-3.0) | `brew install plantuml` |
| Diagrams | Python code → cloud architecture icons | Free · OSS (MIT) | `pip install diagrams` |
| Excalidraw | Hand-drawn whiteboard, imports Mermaid | Free · OSS (MIT) | `npm install @excalidraw/excalidraw` |
| drawDB | Visual database schemas, exports SQL | Free · OSS (AGPL-3.0) | Clone, then `docker build -t drawdb .` |
| Kroki | One API renders 20+ languages | Free · OSS (MIT) | `docker run -d -p 8000:8000 yuzutech/kroki` |

## 1. Mermaid: the markup GitHub already renders

[Mermaid](https://github.com/mermaid-js/mermaid) is a JavaScript tool that draws diagrams and charts from Markdown-like text.

**What:** Flowcharts, sequence, Gantt, state, ER and mindmap diagrams from text that lives in your README.

**Why:** GitHub and GitLab render Mermaid code blocks natively: paste markup, get a picture, no tooling.

**Use when:** Diagrams belong in docs, PRs and chat replies.

**Install:**

```bash
npm install mermaid
```

**Catch:** Layout is automatic with little control, so large diagrams get messy.

## 2. D2: the modern engine with better layouts

[D2](https://github.com/d2lang/d2) is a diagram language with a CLI: write text, run one command, get an SVG. It bundles three layout engines you can switch between.

**What:** `d2 --watch in.d2 out.svg` re-renders on every save; themes, icons and container nesting built in.

**Why:** More control over layout and styling than Mermaid, for output you can put in a slide.

**Use when:** The diagram itself is the deliverable.

**Install:**

```bash
curl -fsSL https://d2lang.com/install.sh | sh -s --
```

**Catch:** Nothing renders D2 natively in GitHub or chat apps — you ship SVG files instead.

## 3. PlantUML: the UML veteran, now with an MCP server

[PlantUML](https://github.com/plantuml/plantuml) draws UML (standard software design notation) diagrams from text. Its new `@plantuml/mcp-js` server lets your AI assistant render and check PlantUML through MCP (Model Context Protocol), with no Java.

**What:** Sequence, class, component, deployment and 20+ other diagram types from text.

**Why:** It covers formal UML types the lighter languages skip.

**Use when:** You need formal UML — class diagrams, sequence flows — beyond boxes and arrows.

**Install:**

```bash
brew install plantuml
```

**Catch:** The classic engine needs Java; only the MCP server and a browser JavaScript build run without it.

## 4. Diagrams: cloud architecture as Python code

[Diagrams](https://github.com/mingrammer/diagrams) is Diagram as Code: Python scripts that place real AWS, GCP, Azure, Kubernetes and on-prem icons into architecture diagrams.

![A stateful architecture diagram rendered by Diagrams: pods, services, PVCs, a PV and a storage class wired together](https://f.aifree.dev/media/best/text-to-diagram/f452c8cd9f14d5a3.webp#w=1070&h=572)

**What:** Python nodes and edges render through Graphviz, a graph layout tool, into architecture diagrams with real provider icons.

**Why:** Infra diagrams become reviewable code — diff them in PRs like everything else.

**Use when:** You document cloud systems and want versioned, reproducible pictures.

**Install:**

```bash
pip install diagrams
```

**Catch:** You must install Graphviz separately (`brew install graphviz` on macOS), and it suits architecture diagrams only.

## 5. Excalidraw: hand-drawn looks, visual edits

[Excalidraw](https://github.com/excalidraw/excalidraw) is an open-source whiteboard with a hand-drawn style, for diagrams and wireframes you keep editing visually.

**What:** An infinite canvas with libraries, plus a Mermaid-to-Excalidraw converter so generated text becomes editable shapes.

**Why:** Generate a first draft from text, then fix the layout by dragging.

**Use when:** People will keep editing the picture by hand.

**Install:**

```bash
npm install react react-dom @excalidraw/excalidraw
```

**Catch:** There is no CLI: you draw at excalidraw.com, and the npm package embeds the editor in your own React app.

## 6. drawDB: database schemas you can edit by hand

[drawDB](https://github.com/drawdb-io/drawdb) is a browser editor for database diagrams (ERDs): draw tables and relationships, then import or export SQL, with no account.

![drawDB editor: a bank schema with accounts, transactions, customers, loans and investments tables wired by relationships](https://f.aifree.dev/media/best/text-to-diagram/1b82c86cb5299afe.webp#w=1280&h=608)

**What:** A browser editor for ER diagrams with type pickers, indexes and SQL export per dialect.

**Why:** It turns SQL into a diagram and back, free and self-hostable.

**Use when:** You are designing or explaining a database schema.

**Install:**

```bash
git clone https://github.com/drawdb-io/drawdb
cd drawdb
docker build -t drawdb .
docker run -p 3000:80 drawdb
```

**Catch:** AGPL-3.0, and file sharing needs a separate companion server.

## 7. Kroki: one API renders them all

[Kroki](https://github.com/yuzutech/kroki) is one API for 20+ diagram languages, including Mermaid, PlantUML, D2, Excalidraw, GraphViz, Vega and DBML.

**What:** A self-hostable service: POST diagram text, get SVG or PNG back.

**Why:** Your docs pipeline renders every format with one dependency instead of seven.

**Use when:** You run a docs site or CI that must render whatever markup lands in it.

**Install:**

```bash
docker run -d -p 8000:8000 yuzutech/kroki
```

**Catch:** Mermaid, BPMN, Excalidraw and diagrams.net (experimental) need separate companion containers. The single `docker run` covers the rest.

## Which one to try first

Diagrams in docs and PRs → #1. Slide-ready output → #2. Formal UML → #3. Cloud architecture → #4. Hand-edited pictures → #5. Database schemas → #6. One renderer for everything → #7.

## Picks

1. [Mermaid](https://github.com/mermaid-js/mermaid)
2. [D2](https://github.com/d2lang/d2)
3. [PlantUML](https://github.com/plantuml/plantuml)
4. [Diagrams](https://github.com/mingrammer/diagrams)
5. [Excalidraw](https://github.com/excalidraw/excalidraw)
6. [drawDB](https://github.com/drawdb-io/drawdb)
7. [Kroki](https://github.com/yuzutech/kroki)

## Frequently asked questions

### Which diagram language should Claude generate?

Mermaid when the diagram lives in docs, PRs or chat — GitHub and GitLab render it natively. D2 when you want a cleaner standalone SVG, PlantUML when you need formal UML types like sequence and class diagrams.

### Can I render all these languages through one endpoint?

Yes — Kroki provides a unified API covering Mermaid, PlantUML, D2, Excalidraw, GraphViz, Vega, DBML and more. Run it with one docker command and POST diagram text to get SVG or PNG back.

### Is Excalidraw diagram-as-code?

No — it is a visual whiteboard. The bridge is its Mermaid-to-Excalidraw converter: text generates the first draft, then you edit shapes by hand while keeping the hand-drawn look.

## Sources

- https://github.com/mermaid-js/mermaid
- https://github.com/d2lang/d2
- https://github.com/plantuml/plantuml
- https://github.com/mingrammer/diagrams
- https://github.com/excalidraw/excalidraw
- https://github.com/drawdb-io/drawdb
- https://github.com/yuzutech/kroki
- https://plantuml.com/

HTML page: https://aifree.dev/best/text-to-diagram
