Mermaid live editor

Write diagrams as text and watch them draw. Flowcharts, sequence, class, ER, state, Gantt, pie, mindmap and timeline, with SVG and PNG export.

Preview100%

Start typing Mermaid code on the left.

Mermaid syntax in two minutes

Every diagram starts with its type on the first line, then one statement per line. Indentation is for readability only.

DiagramFirst lineCore syntax
Flowchartflowchart TD (or LR)A[Box] --> B{Decision}, B -- label --> C, (round), ((circle))
SequencesequenceDiagramAlice->>Bob: request, Bob-->>Alice: reply, loop/alt … end
ClassclassDiagramAnimal <|-- Dog, members in class X { }
StatestateDiagram-v2[*] --> Idle, Idle --> Busy: event
ERerDiagramA ||--o{ B : has (crow’s foot cardinality)
GanttganttdateFormat, section, Task :id, 2026-10-01, 5d
Piepie title …"Label" : 42

Common errors

  • Parentheses or quotes in labels: wrap the label in double quotes, A["Call API (v2)"].
  • The word end as a node id breaks flowcharts; capitalise it or quote it.
  • Wrong arrow for the type: --> is a flowchart arrow, ->> is a sequence message.
  • Gantt dates must match the dateFormat you declared.

Using diagrams in Markdown

Put the code in a fenced block tagged mermaid. GitHub has rendered these in READMEs, issues and wikis since 2022; GitLab, Azure DevOps, Obsidian, Notion and Docusaurus do as well. The Markdown editor here previews them too.

Questions people ask

What is Mermaid?
Mermaid is an open-source JavaScript library that draws diagrams from a short text syntax. GitHub, GitLab, Notion, Obsidian and many docs tools render ```mermaid code blocks as diagrams.
How do I add a Mermaid diagram to a GitHub README?
Wrap the diagram code in a fenced block with the language mermaid. Press “Copy as Markdown” here to get exactly that.
Can I export the diagram as an image?
Yes. Download SVG for a sharp vector file (best for docs and slides) or PNG at 2× resolution for chat and email.
What does “Describe with AI” do?
You describe the diagram in plain words and an AI model writes the Mermaid code, which then renders here. You can edit the code afterwards. If a diagram fails to parse, “Fix with AI” sends the code and the error message to be corrected.
Is my diagram saved?
Yes, in this browser’s localStorage, so it’s still there when you come back. Nothing is uploaded unless you use an AI button.

Related tools