Mermaid Diagram Renderer
Render flowcharts, sequence, class, state, ER, Gantt, and pie diagrams from Mermaid source. Export SVG / PNG.
published
- [FREE]
- [NO_SIGNUP]
- [NO_UPLOAD]
A Mermaid diagram renderer turns a text-based diagram source into an SVG image — flowcharts, sequence diagrams, class diagrams, state machines, ER schemas, Gantt charts, pies, and more. This tool runs the standard Mermaid library inside your browser tab. Source and rendered SVG never touch a server.
How to use the Mermaid renderer
- Pick a sample or paste source. The Load sample dropdown has 7 starting points — flowchart, sequence, class, state, ER, Gantt, pie. Or paste any valid Mermaid 11 syntax.
- Choose a theme. Default / Dark / Forest / Neutral. Renderer re-initializes when you switch.
- Watch it render live. Every edit triggers a debounced re-render (400 ms). Parse errors surface inline.
- Export. Copy SVG, Download SVG, or Download PNG (2x rasterized). Share link round-trips source + theme.
Quick syntax tour
Flowchart
flowchart LR
A[Start] --> B{Check}
B -->|yes| C[Done]
B -->|no| D[Retry]
D --> B
LR = left-to-right. TB, RL, BT also work. Shapes: [] rectangle, () rounded, {} diamond, (()) circle, [/ /] parallelogram, [( )] cylinder.
Sequence diagram
sequenceDiagram
Alice->>Bob: Hi
Bob-->>Alice: Hi back
Note over Alice,Bob: They greeted
->> solid arrow, -->> dashed reply, Note over X,Y: for annotations. Add participant X as Long Name to control display order.
Class diagram
classDiagram
class User {
+UUID id
+String name
+login() bool
}
User "1" --> "*" Order
+ public, - private, # protected. Relationship arrows: --> association, *-- composition, o-- aggregation, --|> inheritance.
State diagram (v2)
stateDiagram-v2
[*] --> Idle
Idle --> Loading: fetch()
Loading --> Success: 200
Loading --> Error: 4xx
Success --> [*]
[*] = start/end pseudostate. state Composite { … } for nested.
ER diagram
erDiagram
USER ||--o{ ORDER : places
USER {
uuid id PK
string email
}
Cardinality: ||--|| one-to-one, ||--o{ one-to-many, }o--o{ many-to-many. Inside braces, list attributes; tag with PK, FK, or UK.
Gantt
gantt
title Sprint
dateFormat YYYY-MM-DD
section Backend
API :a1, 2026-05-14, 3d
Migrate :a2, after a1, 2d
dateFormat controls input parsing; output is always rendered against that format.
Pie
pie title Browser share
"Chrome" : 64
"Safari" : 19
One slice per "label" : value line. Percentages computed automatically.
When to reach for Mermaid
| Goal | Type |
|---|---|
| API request lifecycle | sequenceDiagram |
| Microservice topology | flowchart |
| Database schema in a PR description | erDiagram |
| State machine for a finite-state system | stateDiagram-v2 |
| OO class relationships | classDiagram |
| Sprint planning in a README | gantt |
| User-journey map | journey |
| Quick proportional breakdown | pie |
If the diagram is informational and version-controlled, Mermaid wins. If it needs interactive editing with visual tooling (collaborative whiteboard, freeform shapes), use draw.io, Excalidraw, or Figma instead.
Common errors and fixes
| Symptom | Fix |
|---|---|
Parse error on line N | Check arrow syntax (--> not ->). Mermaid is strict. |
Node ID end or class fails | Reserved word — rename or quote: nodeEnd[End]. |
| Label has special chars | Wrap in ["…"]: A["My, Label"]. |
| Sequence diagram actors out of order | Declare with participant A as Alice in the order you want. |
| Gantt dates parse wrong | Check dateFormat YYYY-MM-DD matches your input format. |
| State diagram (old) syntax | Use stateDiagram-v2, not the deprecated stateDiagram. |
How it compares
| bytefork.tools | mermaid.live | mermaidchart.com | |
|---|---|---|---|
| Runs in browser | ✓ (lazy-loaded) | ✓ | ✓ |
| All Mermaid 11 diagram types | ✓ | ✓ | ✓ |
| SVG + PNG export | ✓ | ✓ | ✓ |
| 4 built-in themes | ✓ | ✓ | ✓ |
| Share-by-URL hash (no account) | ✓ | ✓ | requires account |
| Ad-free | ✓ | ✓ | ✓ |
| Paid tier for advanced editing | ✗ | ✗ | ✓ |
mermaid.live is the canonical official editor maintained by the Mermaid team. This tool is similar in scope; the differences are the brand-consistent UI and integration with the rest of the bytefork toolset.
Privacy and security
A static HTML page with a small initial JavaScript bundle. The Mermaid library lazy-loads (~600 KB gzip) on first render. Once loaded it runs entirely in your browser tab. Source, parsed AST, and rendered SVG never leave the page. Mermaid is initialized with securityLevel: strict — HTML in node labels is sanitized, no scripts execute from diagram content.
Related tools
- Markdown ↔ HTML Converter — Mermaid blocks render natively in GitHub-flavored Markdown when wrapped in a
mermaidcode fence. Convert to/from HTML and inspect the wrapper. - SVG Optimizer — shrink the rendered SVG before committing to your docs repo.
- Image Format Converter — if you need JPG/WebP instead of PNG.
Frequently asked questions
Is my diagram source sent to a server?
No. Rendering runs via the Mermaid library lazy-loaded into your browser tab. Source text, parsed AST, and generated SVG all stay on your device. Open DevTools → Network and you will see no outbound request with your diagram content.
What is Mermaid?
A text-based diagramming language. Write a few lines describing your flowchart, sequence, or schema, and a renderer turns it into an SVG diagram. GitHub renders Mermaid in README files; many docs sites and Notion-like tools support it natively. The advantage over visual editors is version-controllability — your diagram diff is the source diff.
Which diagram types are supported?
All the standard types Mermaid 11 supports: flowchart (and the older graph), sequenceDiagram, classDiagram, stateDiagram-v2, erDiagram, gantt, pie, journey, mindmap, timeline, gitGraph, quadrantChart, requirement, and C4Context. The Load sample dropdown has 7 ready-to-edit templates covering the common cases.
Why is the first render slow?
The Mermaid library is ~3 MB raw / ~600 KB gzipped and lazy-loads on your first render. Subsequent renders are instant. The initial page paints fast because Mermaid is not in the critical bundle.
Can I export to PNG?
Yes. PNG export rasterizes the SVG at 2x scale onto a canvas (white background for default/forest/neutral themes, dark for dark theme). Use SVG for editable vectors, PNG for embedding in slides or chat.
What does the theme dropdown do?
Mermaid ships four built-in themes: default (light blue), dark, forest (green), neutral (grayscale). Switches the rendered colors. The tool re-initializes Mermaid when theme changes, so subsequent renders use the new theme.
Can I render arbitrary HTML inside a node label?
No — the renderer runs with `securityLevel: strict`, which sanitizes HTML in labels. Mermaid expressions like `node["multi<br/>line"]` work because they are part of the Mermaid grammar; raw <script> or <iframe> tags do not.
Why does my flowchart fail with a vague error?
Mermaid error messages can be terse. Common causes: missing arrow syntax (`-->` not `->`), unquoted labels with spaces (use `["My Node"]`), reserved-word collisions (node IDs cannot be `end`, `class`, `style`, etc — quote them or rename). The parser surfaces the line number when it can.
Can I share my diagram via URL?
Yes. The share link encodes the source text and theme into the URL fragment. Recipients see the same diagram. The fragment never leaves your browser network-wise, but it does carry the diagram source verbatim — don\'t share if the diagram has secrets.
Is the Mermaid renderer really free?
Yes. No signup, no account, no ads, no telemetry on your input. The source is on the project repository.