Mermaid Diagram Preview
Type Mermaid diagram text, or paste a whole Markdown file and step through its mermaid fences — the renderer loads only when you ask it to.
Off until you turn it on, and never restored from a link — so no shared link downloads the renderer on its own.
The diagram appears here once you render it.
The preview and both downloads read the same neutralized SVG.
Removed from the SVG before preview:
Mermaid 11.16.1 · The renderer has not been downloaded yet.
Mermaid is an MIT-licensed open-source project; the official Mermaid Live Editor is at mermaid.live — this page is an independent, entirely local preview.
Diagram text, the rendered SVG and both downloads stay in this tab. Nothing is uploaded.
PNG is rasterized at 2× in this browser. For other sizes, use SVG to PNG. SVG to PNG
Click bindings and tooltips stay inert here: the renderer runs in Mermaid's strict security level, which this page never relaxes.
Source view lists every label as text — the complete path for a screen reader.
Diagram types this Mermaid version registers
flowchartsequenceDiagramclassDiagramstateDiagram-v2erDiagramjourneyganttpiequadrantChartrequirementDiagramgitGraphC4Contextmindmaptimelinesankey-beta(beta)xychart-beta(beta)block-beta(beta)packet-beta(beta)kanbanarchitecture-beta(beta)radar-beta(beta)treemap-beta(beta)swimlane-beta(beta)venn-beta(beta)treeView-beta(beta)wardley-beta(beta)cynefin-beta(beta)ishikawa-beta(beta)info
Press ? for shortcuts
Do it offline:$
How to use it
- Pick how the input is read. Diagram text draws what you type; Markdown document parses a pasted file and lists every mermaid fence with its line range.
- Press Render diagram. The first press fetches the drawing library into this tab; the diagram pane keeps its size throughout, and Cancel abandons the fetch.
- Recolour with one of Mermaid's four built-in themes, or open Source to read the SVG as text — it carries every label a picture alone cannot.
- Save with Download SVG or Download PNG. Both files are written from the neutralized SVG the pane shows, so the picture on screen is the one in the file.
Type Mermaid diagram text and watch the diagram appear beside it, or paste a whole Markdown file and step through the mermaid fences inside it. The renderer is a heavy download, so it arrives only when you ask for a drawing. Diagram text, the SVG and both downloads stay in this tab.
Examples
flowchart TD
A[Paste Markdown] --> B{mermaid fence?}
B -- yes --> C[Render locally]
B -- no --> D[Show as code]
Type: flowchart-v2
Mermaid 11.16.1
The preview and both downloads read the same neutralized SVG.Four nodes and a decision, drawn in this tab. The type line starts as a guess from the first keyword and is replaced by the one Mermaid itself reports once the library loads.
# Deploy runbook
```mermaid
flowchart TD
A[Paste Markdown] --> B{mermaid fence?}
B -- yes --> C[Render locally]
B -- no --> D[Show as code]
```
Build it with:
```bash
npm run build
```
```mermaid
sequenceDiagram
Reader->>Page: Paste diagram text
Page-->>Reader: SVG
```
2 mermaid fences found
Fence 1 of 2 — lines 3–8 — Type: flowchart-v2
Fence 2 of 2 — lines 16–20 — Type: sequenceThree fenced blocks, two of them mermaid, listed in document order with the lines of their delimiters. The shell block is left alone: a fence is rendered only when its first info word is mermaid, compared without regard to case.
flowchart TD
A[Start] -->> B]
Parse error on line 2:
...rt TD A[Start] -->> B]
----------------------^
Expecting 'AMP', 'COLON', 'PIPE', 'TESTSTR', 'DOWN', 'DEFAULT', 'NUM', 'COMMA', 'NODE_STRING', 'BRKT', 'MINUS', 'MULT', 'UNICODE_TEXT', got 'TAGEND'
Reported position: line 2, column 11.An arrow typed with one dash too few. Mermaid's parser wrote every character above the last line, caret frame included, and this page repeats it without editing a byte; its reported position, line 2 column 11, is printed under the message. In a Markdown file, that position counts in the file, not in the fence.
%%{init:{'securityLevel':'loose','htmlLabels':true}}%%
flowchart LR
A["<b>bold?</b>"] --> B[end]
Type: flowchart-v2
Mermaid 11.16.1
The preview and both downloads read the same neutralized SVG.
Removed from the SVG before preview:
Removed role attribute from <svg>.
Removed aria-roledescription attribute from <svg>.
Removed data-edge attribute from <path>.
Removed data-et attribute from <path>.
Removed data-id attribute from <path>.
Removed data-points attribute from <path>.
Removed data-look attribute from <path>.
Removed marker-end attribute from <path>.
Removed data-id attribute from <g>.
Removed <foreignObject> element and its content.
Removed data-look attribute from <g>.
Removed <foreignObject> element and its content.
Removed data-look attribute from <g>.
Removed <foreignObject> element and its content.A pasted directive asking for the relaxed security level and for HTML labels. Mermaid refuses the security level outright — that key is on its protected list — but HTML labels are not protected, so three labels came back as embedded HTML, and the neutralizer deleted all three with their contents. Every line under that heading is the chip list, unedited.
Every example on this page is executed against the same engine that powers the tool, on every build.
Gotchas worth knowing
Fences are found by parsing, not by pattern matching
A mermaid line inside a four-backtick example block or indented code is not a fence. Tilde fences count, so do fences in a list item or blockquote. An info string such as mermaid title="Q3" still renders: the first word decides.
Only line endings are normalized
A byte-order mark is dropped and carriage returns become newlines, both announced. Tabs, non-breaking spaces and blank lines survive untouched: the grammar is whitespace-sensitive.
A directive cannot unlock interactive behaviour
The security level is on Mermaid's protected key list, so pasted instructions to relax it fail — measured, not assumed. Click handlers stay inert by design.
HTML labels are removed rather than trusted
A directive can still ask for HTML labels, which arrive wrapped in foreignObject elements; those are deleted with their contents, and smuggled HTML that is not well-formed XML gets the drawing refused rather than guessed at. Mermaid's role and data- attributes go too — hence the pane's own caption.
Very long diagrams: two different limits
Past 50,000 characters Mermaid 11.16.1 quietly swaps in a one-node notice diagram and raises nothing, so no message can be shown. This tool refuses above 100,000 characters, 400,000 for a pasted file, and 20 fences per file — never cutting input to size.
A PNG here can differ from one made elsewhere
Rasterizing happens locally at twice the drawing size using this device's fonts, and no web font is fetched, so letterforms can differ elsewhere.
Common errors
No diagram type detected matching given configuration for text: nosuchdiagram A --> B- Mermaid read the first keyword, found no grammar under it and said so in its own words. This page lists the twenty-nine types it knows, spelled as this version spells them.
No ```mermaid fences in this document (1 fenced code block found, left as code).- Document mode found code, just none tagged as a diagram. Other fences are counted, never rendered.
Diagram text is 120000 characters, over the 100000 character limit for this tool.- A refusal, not a truncation: the text is still in the editor, unchanged.
Document holds 21 mermaid fences, over the 20 fence limit for this tool.- One pasted file may carry twenty diagrams. Beyond that the tool stops rather than rendering an arbitrary subset.
The Mermaid 11.16.1 renderer could not be downloaded: Failed to fetch dynamically imported module- The library never arrived — offline, blocked or cancelled. Whatever was on screen stays there; Render retries.
Mermaid did not finish rendering within 5000 ms, so rendering was stopped.- A pathological diagram can keep the layout engine busy forever. After five seconds the attempt is abandoned and the previous picture returns.
FAQ
Does the diagram text I paste leave this device?
No. Parsing, layout, drawing and rasterizing all happen in this tab, and the only thing ever fetched is the drawing library itself, from this site, after you press Render. A shared link carries its state after the URL's hash, which browsers never send.
Which Mermaid version draws these diagrams, and can I change it?
Mermaid 11.16.1, the copy shipped with this page; its number is printed under the diagram once it loads, and the type list comes from that version's own registry, including the thirteen it still spells with a beta suffix. There is no version picker.
Is this the Mermaid Live Editor?
Mermaid is an MIT-licensed open-source project; the official Mermaid Live Editor is at mermaid.live — this page is an independent, entirely local preview. Its angle is markdown context: paste a README and walk its fences, with no account and no interactive diagram features.
Keyboard shortcuts
- ⌘/Ctrl + Enter
- Render the diagram.
- ⌘/Ctrl + S
- Download the SVG.
- ⌘/Ctrl + C
- Copy the SVG source, nothing selected.
- ⌘/Ctrl + Shift + C
- Copy the SVG source regardless.
- t
- Cycle the theme palette.
- ? or ⌘/Ctrl + /
- Open the shortcut overlay.
- Esc
- Close the topmost dialog.