Mermaid Diagram Editor

Create flowcharts, sequence diagrams, class diagrams, Gantt charts, and more from simple text syntax. Live preview with SVG and PNG export.

Runs in your browser. No data leaves your device.

About this tool

A live editor for Mermaid text diagrams with SVG and PNG export. Write flowcharts, sequence, class, state, ER, Gantt, pie or git graph diagrams as text and see them render beside the code. Good for documentation diagrams you want to keep as text.

Features
  • Mermaid 11 (bundled npm package, not a CDN) renders the diagram 400 ms after you stop typing
  • Syntax errors are shown under the editor with Mermaid's message
  • Examples menu with 8 starters: Flowchart, Sequence, Class, State, Gantt, Pie, ER, Git Graph
  • Reset button restores the default flowchart
  • Diagram follows the site light/dark theme and re-renders when the theme changes
  • Copy Code button, plus Copy and pipeline buttons for the rendered SVG markup
  • Download SVG (mermaid-diagram.svg) and PNG (mermaid-diagram.png at 2x the diagram's natural size, on the preview's background colour)
  • Export buttons stay in place (disabled) while the code has an error, so the editor never jumps
  • Side-by-side editor and preview layout
How to use it
  1. Type Mermaid code starting with a diagram type, e.g. "flowchart TD", or pick one from Examples
  2. Watch the preview update; fix any error shown under the editor
  3. Click SVG or PNG to download, or copy the code/SVG
Inputs
  • Mermaid diagram syntax as text; any diagram type Mermaid 11 can render, with the 8 examples as starting points
Outputs
  • Rendered SVG markup (copy, chain, or .svg download)
  • PNG at 2x the on-screen size
Limits and notes
  • Rendering uses securityLevel "strict"
  • For PNG export, HTML labels (foreignObject) are replaced with plain, centred 14px SVG text, so multi-line labels and formatting can differ from the preview; the SVG download is unaffected
  • Mermaid needs the CSP 'unsafe-eval' allowance; the code only renders what you type locally
  • The diagram code is saved in localStorage under overtooled:mermaid-diagram:code
  • Runs fully in the browser; nothing is uploaded

Frequently Asked Questions

How does the Mermaid Diagram Editor work?

The tool passes your text-based diagram definition to the Mermaid.js library, which parses the syntax into a graph data structure (nodes and edges), applies a layout algorithm (dagre for flowcharts, custom layouts for other types), and renders the result as an SVG element with positioned shapes, arrows, and labels. The live preview re-renders on each keystroke via debounced input.

What diagram types can I create?

Flowcharts, sequence diagrams, class diagrams, state diagrams, entity-relationship diagrams, Gantt charts, pie charts, and more. Mermaid supports most common diagram types used in software documentation.

Do I need to know Mermaid syntax?

Basic syntax is quick to learn. A flowchart starts with a line like "flowchart TD", followed by edges such as "A --> B". The Examples menu has 8 starter diagrams, and the preview updates as you type so you can experiment.

Can I export my diagram?

Yes. Download your diagram as SVG (vector, infinite resolution) or PNG (raster image). SVG is ideal for documentation and websites, while PNG works for presentations and chat messages.