Mermaid Live Editor
Write diagram-as-code, check its syntax and preview flowcharts, sequence diagrams and pie charts locally.
Mermaid source
Diagram preview
No diagram yet
Type Mermaid syntax or load the flowchart example.
Examples
Decision flow
A[Start] --> B{Approved?}
B -->|Yes| C[Ship]Three nodes and two labelled edgesDiamond shapes and arrow labels are recognised by the preview parser.
Broken bracket
A[Start --> B[Done]Error at line 2 with the unclosed bracket columnThe checker reports the location without clearing your source.
Sequence
Client->>API: GET /usersDiagram type: sequenceDiagram, text viewMessages require a colon; participants are counted in the status line.
About this tool
Mermaid Live Editor is a scratchpad for diagram-as-code. Write Mermaid syntax in the source pane and the tool detects the diagram type, checks bracket balance with line and column reporting, and builds a deterministic SVG preview for simple flowcharts. Zoom controls let you inspect a dense graph, and the share link encodes the source in the URL fragment so a teammate can open the same diagram without a server.
Validation is deliberately non-blocking: a missing bracket produces a clear banner with its location while your source remains intact for editing. Comments and frontmatter separators are ignored by the checker, and sequence diagrams receive a specific warning when a message is missing its colon.
For flowcharts the preview parser extracts nodes from [square], (round) and {diamond} labels and edges from -->, --- and ==> arrows, including arrow labels of the form -->|text|. It lays out nodes in layers, escapes all text before generating SVG, and supports zoom in, zoom out and fit-to-view.
Other Mermaid types — sequence, class, state, ER, gantt, pie, gitGraph and journey — are type-detected and shown in a text view with syntax feedback. Everything runs locally in the browser: no render service, no account and no upload of diagram code.
What this tool does not do
- Only simple flowchart node/edge forms are rendered to SVG; sequence, class, state, ER, gantt, pie and gitGraph get a text view.
- The generated SVG does not include Mermaid's full layout engine, themes or font handling.
- Share links are version-tagged and cannot decode formats from other Mermaid editors.
- PNG export and embedded Markdown images are not provided; download the SVG instead.
- Diagrams are kept in memory for the session and are not persisted between reloads.
How to use this tool
Load a starter or type a diagram
Use the example chips for a flowchart, sequence diagram, pie chart or a deliberately broken bracket case, or paste your own Mermaid source.
Read the validation banner
Errors include line and column; warnings describe likely syntax issues without hiding the preview. Fix the source and the result updates.
Inspect the flowchart
Use the zoom in, zoom out and fit-to-view controls. The zoom percentage is shown next to the detected diagram type.
Share or export
Copy the generated share URL for a teammate, copy the SVG/code, or download the SVG for a document. Non-flowchart types export their source.
Use cases
README diagrams
Iterate on flowchart syntax and copy a clean SVG or source snippet for documentation.
PR reviews
Validate a teammate's diagram code and share an exact reproduction link.
Teaching
Demonstrate node/edge structure and how a missing bracket breaks a diagram.
Quick visual checks
Confirm a small flowchart's structure without installing a CLI.
Flowchart shapes and arrows recognised by the preview
| Syntax | Meaning |
|---|---|
| A[Label] | Rectangle node |
| A(Label) | Rounded node |
| A{Label} | Decision/diamond node |
| A --> B | Directed edge |
| A --- B | Undirected edge |
| A -->|yes| B | Labelled edge |
| %% comment | Ignored by validation and preview |
The SVG preview is intentionally simple; complex Mermaid layouts need a full Mermaid renderer.
Common mistakes
Mistake:Expecting full Mermaid rendering for every diagram type.
Fix:The SVG preview covers simple flowcharts; other types are validated and shown as text.
Mistake:Pasting Mermaid.live pako-compressed links here.
Fix:Share links use this tool's own version-tagged m1. payload; paste the diagram source instead.
Mistake:Using click callbacks or HTML labels.
Fix:They may be valid Mermaid but are not executed or previewed here; keep diagrams declarative.
Mistake:Treating a warning as a broken diagram.
Fix:Only errors block the preview; warnings are advisory.
Mistake:Assuming the share link stores data on a server.
Fix:The source is encoded in the URL fragment; nothing is stored server-side.
Frequently asked questions
Which diagram types are supported?
The editor detects flowchart, graph, sequence, class, state, ER, gantt, pie, gitGraph and journey diagrams. Flowcharts and graphs get a generated SVG preview; the other types are syntax-checked and displayed in a text view.
Why does my syntax error show a line and column?
The checker scans each line for unmatched brackets and reports the first offending position, so you can jump straight to the mistake. Errors keep your source intact; only the preview is withheld until the syntax is fixed.
Can I export a PNG?
No. This dependency-free editor exports SVG (for flowcharts) and copies the source. For a PNG, open the downloaded SVG in an image editor or use a full Mermaid renderer.
How do share links work?
Copy share URL encodes the diagram source and selected theme as version-tagged, base64url-encoded UTF-8 JSON in the URL fragment. No server stores the diagram. Links from other editors using different compression formats cannot be decoded here.
Is my diagram code uploaded anywhere?
No. Validation, preview generation and share encoding all happen in your browser. There is no render service and no telemetry on diagram contents.
Does the preview match GitHub's Mermaid rendering?
Not exactly. The preview is a deliberately simple flowchart renderer, while GitHub uses the full Mermaid library. Use this tool to check syntax and structure, then confirm final layout on the platform where the diagram will live.
References & standards
Related tools
AssemblyScript Playground
Write AssemblyScript-style functions, inspect a module preview, and run exports with a step-bounded offline evaluator.
Bash Playground
Test bash script snippets in a local mini-shell with seeded files, stdin, stream tags and visible sandbox limits.
C & C++ Playground
Check C and small C++ source for structural problems, map findings to lines and see the compile command for a local toolchain.
C# Playground & Snippet Checker
Static pre-flight checks for C# snippets — diagnostics, detected features and metrics, entirely in-browser.
Dart Playground
Write Dart, press Run, and see print output in your browser.
DBML Playground
Write DBML and see an ER diagram plus SQL DDL for Postgres, MySQL, SQLite and MSSQL, all in your browser.