Free tool

Mermaid live editor

Type Mermaid code on the left and the diagram renders on the right as you type. Start from a template for any of 24 diagram types, switch themes, and export the result as SVG, PNG or PDF (PNG up to 4x, transparent if you like) or copy it as a Markdown block for GitHub. Errors point to the line and say how to fix them, and share links use the mermaid.live format, so they open in both editors.

Free · no sign-up · runs in your browser, nothing is uploaded

Mermaid code
Previewloading Mermaid…
fit

Loading Mermaid…

Diagram type

Flowchart

flowchart

Lines

7

201 B

Render time

-

SVG size

-

Drop a .mmd or Markdown file here, or click to open one. The first ```mermaid block is used.

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.

DiagramFirst lineGood for
Flowchartflowchart TDProcesses, decisions, system flows
Sequence diagramsequenceDiagramRequests between services, API calls, login flows
Class diagramclassDiagramClasses, fields, methods and relations
State diagramstateDiagram-v2States of an order, a ticket or a UI
ER diagramerDiagramDatabase tables, keys and relations
Gantt chartganttProject plans with tasks and dates
Pie chartpieShares of a whole
User journeyjourneySteps a user takes, scored by feeling
Git graphgitGraphBranches, commits and merges
MindmapmindmapIdeas around one topic, by indentation
TimelinetimelineEvents by period
Quadrant chartquadrantChartTwo-axis priority grids (effort vs impact)
XY chartxychart-betaBar and line charts
Sankey diagramsankey-betaFlows between stages, as CSV rows
Block diagramblock-betaBoxes in a grid you place yourself
Requirement diagramrequirementDiagramRequirements and what satisfies them
C4 diagramC4ContextSoftware architecture in the C4 model
Packet diagrampacket-betaBit layout of network headers
Architecture diagramarchitecture-betaCloud services and how they connect
Kanban boardkanbanColumns of tasks
Radar chartradar-betaComparing options on several axes
Treemaptreemap-betaNested totals as rectangles
Venn diagramvenn-betaOverlap between sets
Ishikawa (fishbone)ishikawa-betaCauses 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 --> Done

Settings 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:

ProblemExampleFix
Lowercase end as a nodeA --> endWrite End or END, or quote it.
Brackets inside a labelA[Save (draft)]Quote the label: A["Save (draft)"]
Curly quotes from a documentA[“Hi”]Use straight quotes: A["Hi"]
No diagram type on the first lineA --> BStart with flowchart TD (or another type).
Arrow without a targetA -->Add the node it points to.
Special characters in textA[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.

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.