Free tool
Mermaid live editor
Free · no sign-up · runs in your browser, nothing is uploaded
Loading Mermaid…
Diagram type
Flowchart
flowchart
Lines
7
201 B
Render time
-
SVG size
-
Tip: paste a mermaid.live link or Markdown with a mermaid block into the editor to open it. Ctrl/Cmd + scroll zooms the preview; drag to pan.
How to use this Mermaid editor
Pick a diagram type in Template or paste your own code. The preview updates a moment after you stop typing. If the code has an error, the last diagram that worked stays on screen marked out of date, and a note at the top of the preview gives the line (and the column when Mermaid reports it). Click the line number to jump to it.
The preview zooms with the [-] and [+] buttons or Ctrl/Cmd + scroll, and you can drag it to move around a big diagram. [fit] shrinks the diagram to the panel and [fullscreen] gives it the whole screen. Exports always use the full diagram, whatever the zoom.
You can also drop a .mmd or .md file on the page. For Markdown files, and for pasted text such as an answer from an AI tool, the editor takes the first ```mermaid block. A pasted mermaid.live link opens the diagram it holds. Template, Sample and Clear can be undone once with Undo.
Mermaid diagram types and their first line
The first word of a diagram tells Mermaid which kind it is. Everything after it uses that type's own syntax. Each row below has a template in the editor. Types marked -beta work, but their syntax may still change in a later Mermaid release.
| Diagram | First line | Good for |
|---|---|---|
| Flowchart | flowchart TD | Processes, decisions, system flows |
| Sequence diagram | sequenceDiagram | Requests between services, API calls, login flows |
| Class diagram | classDiagram | Classes, fields, methods and relations |
| State diagram | stateDiagram-v2 | States of an order, a ticket or a UI |
| ER diagram | erDiagram | Database tables, keys and relations |
| Gantt chart | gantt | Project plans with tasks and dates |
| Pie chart | pie | Shares of a whole |
| User journey | journey | Steps a user takes, scored by feeling |
| Git graph | gitGraph | Branches, commits and merges |
| Mindmap | mindmap | Ideas around one topic, by indentation |
| Timeline | timeline | Events by period |
| Quadrant chart | quadrantChart | Two-axis priority grids (effort vs impact) |
| XY chart | xychart-beta | Bar and line charts |
| Sankey diagram | sankey-beta | Flows between stages, as CSV rows |
| Block diagram | block-beta | Boxes in a grid you place yourself |
| Requirement diagram | requirementDiagram | Requirements and what satisfies them |
| C4 diagram | C4Context | Software architecture in the C4 model |
| Packet diagram | packet-beta | Bit layout of network headers |
| Architecture diagram | architecture-beta | Cloud services and how they connect |
| Kanban board | kanban | Columns of tasks |
| Radar chart | radar-beta | Comparing options on several axes |
| Treemap | treemap-beta | Nested totals as rectangles |
| Venn diagram | venn-beta | Overlap between sets |
| Ishikawa (fishbone) | ishikawa-beta | Causes of a problem, by category |
Mermaid flowchart syntax in one minute
A flowchart starts with flowchart and a direction: TD or TB (top to bottom), BT, LR (left to right) or RL. Each line then defines nodes and the links between them. The brackets around a label set the shape.
flowchart LR
A[Rectangle] --> B(Rounded)
B --> C{Decision}
C -- yes --> D([Stadium])
C -. maybe .-> E[(Database)]
C == no ==> F((Circle))
G["Text with (brackets) needs quotes"]
%% comments start with two percent signs
subgraph Backend
E
F
end--> is a solid arrow, -.-> dotted and ==> thick; text goes between the dashes or after a pipe, as in A -->|yes| B. A node is defined the first time its ID appears, so later lines can use just A. Sequence diagrams work the same way with messages: Alice->>Bob: Hi for a request and Bob-->>Alice: Hello for a dashed reply.
Themes, looks and config inside the diagram
The Theme menu sets Mermaid's built-in themes. Only base can be changed with your own colors through themeVariables. The theme you pick here applies to the preview, the exports and the share link. To keep it with the code, so GitHub and your docs use it too, put a front matter block at the very top:
---
title: Checkout flow
config:
theme: base
look: handDrawn
themeVariables:
primaryColor: "#fde68a"
lineColor: "#64748b"
---
flowchart LR
Cart --> Pay --> DoneSettings in the diagram win over the menus above. The title in front matter is also used for the file name of your exports. Older diagrams use an %%{init: {"theme": "forest"}}%% line for the same thing, and Mermaid still reads it.
Common Mermaid errors and how to fix them
Mermaid stops at the first thing it cannot read, so one bad character can blank the whole diagram. These cause most errors, and the editor gives a hint when it spots one of them:
| Problem | Example | Fix |
|---|---|---|
| Lowercase end as a node | A --> end | Write End or END, or quote it. |
| Brackets inside a label | A[Save (draft)] | Quote the label: A["Save (draft)"] |
| Curly quotes from a document | A[“Hi”] | Use straight quotes: A["Hi"] |
| No diagram type on the first line | A --> B | Start with flowchart TD (or another type). |
| Arrow without a target | A --> | Add the node it points to. |
| Special characters in text | A[50% #1] | Quote it, or use entity codes: #35; for #. |
If an error makes no sense, check that the first line is right for the diagram type and that a code block copied from Markdown does not still contain the ``` fence lines.
Use Mermaid in GitHub, GitLab and Markdown docs
GitHub and GitLab render a fenced code block tagged mermaid as a diagram in READMEs, issues, pull requests, wikis and comments. Many docs tools and note apps do the same. Press copy as Markdown to get this:
```mermaid
sequenceDiagram
Browser->>API: GET /orders
API-->>Browser: 200 OK
```Where Mermaid is not rendered (email, slides, some wikis), export a PNG or SVG instead. To shrink an exported SVG, run it through the SVG optimizer; to turn any SVG into a PNG at an exact size, use SVG to PNG. For tables in the same README, try the Markdown table generator.
How share links work
The editor compresses the code and settings and writes them after #pako: in the address bar, the same format the official editor at mermaid.live uses. The part of a URL after # is the fragment, which browsers keep to themselves and do not send to the server. So the link is the only copy of your diagram: we never see it, and it does not expire.
[open in mermaid.live] opens the same diagram there, and a mermaid.live /edit#pako: or /view#pako: link pasted into the editor opens here. Very large diagrams make long links; some chat apps cut those off, so for big diagrams send the .mmd file instead.
The preview uses Mermaid's strict security level, so click handlers and scripts in a diagram you received are not run. Want to document a whole system? Browse documentation tools on DevHunt.
More free developer tools
FAQ
What is the Mermaid live editor?+
It is a page where you type Mermaid code and see the diagram next to it, updated as you type. Mermaid is an open-source JavaScript library that turns text like "A --> B" into flowcharts, sequence diagrams, ER diagrams, Gantt charts and more. This editor runs the Mermaid library in your browser, so nothing needs to be installed.
How do I export a Mermaid diagram as PNG or SVG?+
Press Download PNG or Download SVG under the preview. For PNG you can pick the size (1x to 4x) and a white, dark or transparent background. Copy PNG puts the image on your clipboard so you can paste it straight into a doc, slide or chat. SVG stays sharp at any size and is the better choice for websites. For a PDF, press PDF / print and choose Save as PDF in the print dialog; the PDF keeps the diagram as vector graphics.
How do I share a Mermaid diagram with a link?+
Press Copy share link, or copy the address bar: the diagram is compressed into the part of the URL after #. Browsers do not send that part to the server, so the diagram is not stored anywhere. The format is the same one mermaid.live uses, so the link also opens there, and mermaid.live links pasted into this editor open here.
How do I fix a Mermaid syntax error?+
Read the red note at the top of the preview. It names the line where parsing stopped (and the column when Mermaid reports one) and says what Mermaid expected instead. Click the line number to jump to it in the editor. The usual causes are a lowercase "end" as a node name in a flowchart, brackets or parentheses inside a label without quotes, curly quotes pasted from a document, and a first line that does not name the diagram type.
How do I add a Mermaid diagram to GitHub or GitLab?+
Put the code in a fenced code block with the language set to mermaid, in a README, issue, pull request, wiki or comment. GitHub and GitLab render the block as a diagram. Press "copy as Markdown" above to get the code already wrapped in the fence.
Can I change the Mermaid theme?+
Yes. Pick a theme (default, neutral, dark, forest, base, the neo themes or the redux themes) and a look (classic, hand-drawn or neo) above the editor. To make the theme part of the diagram itself, so it also applies on GitHub or in your docs, add a front matter block at the top with config: theme: forest.
Can I paste Mermaid code from ChatGPT or another AI tool?+
Yes. Paste it into the editor. If you paste the whole answer with a ```mermaid code block in it, the editor takes just the diagram out of it. AI tools often put parentheses inside labels or use syntax from an older Mermaid version, so check the error note if it does not render.
Is this Mermaid editor free and private?+
It is free, with no sign-up and no limits. The diagram is rendered in your browser and is not uploaded or saved on our server. The only copy outside your browser is a share link, and only if you send one to someone.
Sources: Mermaid: syntax reference · Mermaid: flowchart syntax · Mermaid: theming · Mermaid: configuration · mermaid-live-editor (link format) · GitHub Docs: creating diagrams · GitLab Docs: diagrams and flowcharts · RFC 3986: fragment. Checked October 2026.