Mermaid Diagram Editor
Write Mermaid diagrams with a live preview — flowcharts, sequence, ER, Gantt and more — and export them as SVG or PNG.
The diagram shows here.
Drawn in your browser by Mermaid 12.3 (MIT licence): your diagram stays on your device.
Mermaid turns a few lines of text into a diagram: flowcharts, sequence diagrams, class and ER diagrams, Gantt charts, mind maps and more. Type on the left and the diagram redraws on the right. When a line cannot be read, the editor marks it and, for the mistakes people make most, says how to fix it, while the last diagram that worked stays in view.
Diagrams are drawn in your browser by Mermaid 12.3. Your text is kept in this browser's storage, so it is still there when you come back, and is never uploaded.
How to use it
- Start from replaces the text with an example of the chosen type. Undo (Ctrl+Z or ⌘Z) brings your text back.
- Open file loads a
.mmd,.mermaidor.txtfile into the editor, and Clear empties it. - Theme: Match site draws in Mermaid's Default theme on a light page and its Dark theme on a dark one; Default, Neutral, Dark, Forest and Base are Mermaid's own, except that Dark sets the labels on arrows on a darker box, so they read clearly. A theme set in the diagram's own config wins, and the preview's background follows it.
- Syntax help lists the common syntax of the type the first line names, and what every type reads: comments, front matter, the ELK layout and maths.
- Preview: drag to pan; zoom with the buttons, a pinch, or Ctrl (⌘ on a Mac) and the scroll wheel. Fit shows the whole diagram again. With the preview focused, + and − zoom, 0 fits and the arrow keys pan.
- PNG 2× downloads the diagram at twice its drawn size; the arrow beside it offers 1× and 4×, and a transparent background, and the button then repeats your last choice. A size past what browsers can draw (16,777,216 pixels, or 30,000 on a side) is replaced by the largest that fits.
- SVG downloads the vector drawing and Copy SVG copies its code, both, on the theme's background; Copy Markdown copies the text as a
```mermaidblock to paste into a README.
Mermaid draws up to 50,000 characters and 500 links in one flowchart. Click actions are ignored, a click … href line draws its node without the link, and HTML in labels is kept to text formatting. Images and stylesheets that a diagram names by web address, in its lines or in its config (such as a fontFamily holding a url()), are not loaded and are left out of the SVG and PNG, so drawing never contacts another site: an image shape shows a grey placeholder, and icon names such as logos:aws or fa:fa-car show Mermaid's placeholder, as no icon packs are loaded.
Examples
A label with brackets
- Line
- A[Start] --> B[f(x) = 2]
- Suggested fix
- A[Start] --> B["f(x) = 2"]
In a flowchart, brackets and parentheses end a label's shape, so the bracket inside f(x) stops the line being read. The editor marks the line and suggests the same label in quotes, which Mermaid reads as plain text.
Copy Markdown
- Diagram
flowchart LR A[Idea] --> B[Draft] --> C[Ship]- Copied
```mermaid flowchart LR A[Idea] --> B[Draft] --> C[Ship] ```
GitHub, GitLab and many documentation sites draw a block fenced as mermaid as the diagram. Text that holds backticks gets a longer fence, so the block cannot end early.
Diagram types
| Type | First line | Draws |
|---|---|---|
| Flowchart | flowchart | Steps and decisions joined by arrows |
| Sequence diagram | sequenceDiagram | Messages between participants over time |
| Class diagram | classDiagram | Classes, their members and how they relate |
| State diagram | stateDiagram-v2 | States and the transitions between them |
| Entity relationship | erDiagram | Database tables, their columns and relationships |
| Gantt chart | gantt | Tasks on a timeline, with dependencies |
| Pie chart | pie | Parts of a whole |
| Mindmap | mindmap | Ideas branching from one centre, by indentation |
| Timeline | timeline | Events in order, grouped by period |
| Git graph | gitGraph | Commits, branches and merges |
| User journey | journey | Steps a user takes, scored 1 to 5 |
| Quadrant chart | quadrantChart | Points on two axes, in four quadrants |
| Sankey diagram | sankey | Flows between stages, as wide as their amount |
| XY chart | xychart | Bar and line charts |
| Block diagram | block | Blocks placed in columns, which you control |
| Packet diagram | packet | Fields of a network packet, by bit |
| Architecture | architecture-beta | Services and resources, grouped and connected |
| Kanban | kanban | Cards in columns |
| Requirement diagram | requirementDiagram | Requirements and what satisfies or verifies them |
| C4 diagram | C4Context | Software systems at C4's levels of detail |
| Treemap | treemap-beta | Nested rectangles sized by value |
| Radar chart | radar-beta | Values on several axes from one centre |
Frequently asked questions
mermaid in a Markdown file, issue, pull request or wiki is drawn as the diagram. Copy Markdown gives that block. Sites update Mermaid on their own schedule, so syntax that is new in Mermaid 12.3 may not draw on a site still running an older release.layout: elk under config: in front matter at the top of the text, as Syntax help shows. ELK suits large flowcharts, state, class and ER diagrams, with fewer crossing lines than the default. Without it the editor lays diagrams out with dagre, Mermaid's long-standing layout; Mermaid 12 itself picks ELK when nothing is set, so the same text can come out differently in an editor that leaves the default.#. That part of a link stays in the browser: it is not sent to this site's server or any other, so the diagram is never stored anywhere but in the link. A long diagram makes a long link, and some chat apps and QR codes cut links past 2,000 characters; Copy Markdown is then the safer way to send it.See also
- Markdown Editor — to write the README or document the diagram goes in.