Mermaid v11

Mermaid Live Editor & Markdown Preview

Preview Mermaid diagrams inside Markdown as you type, and download any of them as SVG or PNG with the buttons above the diagram.

Browse 13 diagram types
116 words955 chars52 lines

How to use this Mermaid editor

Diagrams live inside ordinary Markdown, so you can write the explanation and the diagram in one document.

Write

Add a ```mermaid code block and type your diagram — or pick a type below and click "Try in editor".

Check

The diagram re-renders as you type. Syntax errors show the message and the line, instead of a blank space.

Export

Click SVG or PNG above a diagram to download it, or export the whole document as HTML or PDF.

Mermaid diagram types & syntax

Thirteen diagram types with a working example each. Click Try in editor to load one into the editor above, then change it.

Flowchart

flowchart

Processes, decision trees, pipelines, architecture overviews.

flowchart TD
    A[Start] --> B{Is it working?}
    B -- Yes --> C[Ship it]
    B -- No --> D[Debug]
    D --> B
  • •Direction: TD (top-down), LR, RL, or BT.
  • •Shapes: [rectangle], (rounded), {diamond}, ((circle)), [(database)].
  • •Label an arrow with -- text --> or -->|text|.

Sequence diagram

sequenceDiagram

API calls, authentication flows, messages between services over time.

sequenceDiagram
    participant Browser
    participant API
    participant DB
    Browser->>API: GET /user/42
    API->>DB: SELECT * FROM users
    DB-->>API: row
    API-->>Browser: 200 OK (JSON)
  • •->> is a solid arrow, -->> a dashed reply.
  • •Add notes with Note over API,DB: text.
  • •Group steps with loop, alt/else, or opt blocks.

Class diagram

classDiagram

Object models, domain models, type hierarchies.

classDiagram
    class Animal {
        +String name
        +speak() void
    }
    class Dog {
        +fetch() void
    }
    Animal <|-- Dog
  • •<|-- inheritance, *-- composition, o-- aggregation, --> association.
  • •Visibility: + public, - private, # protected, ~ package.

State diagram

stateDiagram-v2

UI states, order lifecycles, finite state machines.

stateDiagram-v2
    [*] --> Idle
    Idle --> Loading: fetch()
    Loading --> Success: data
    Loading --> Error: failure
    Error --> Idle: retry
    Success --> [*]
  • •[*] marks the start and end states.
  • •Nest states with state Name { ... }.

Entity relationship diagram

erDiagram

Database schemas and data models.

erDiagram
    CUSTOMER ||--o{ ORDER : places
    ORDER ||--|{ LINE_ITEM : contains
    CUSTOMER {
        string name
        string email
    }
  • •||--o{ reads "exactly one to zero or more".
  • •List attributes inside { } as type name.

Gantt chart

gantt

Project timelines, sprints, release plans.

gantt
    title Release plan
    dateFormat YYYY-MM-DD
    section Backend
    API design     :done, a1, 2026-01-05, 5d
    Implementation :active, a2, after a1, 10d
    section Frontend
    UI             :b1, 2026-01-12, 12d
  • •dateFormat must match the dates you write.
  • •Use after <id> to chain tasks; done, active, and crit change the style.

Pie chart

pie

Simple proportions, survey results.

pie title Time spent on a README
    "Writing" : 45
    "Formatting" : 30
    "Fixing broken tables" : 25
  • •Values are relative — they do not need to add up to 100.
  • •Add showData after pie to print the values.

Mindmap

mindmap

Brainstorming, topic overviews, outlines.

mindmap
  root((Docs))
    Guides
      Getting started
      Tutorials
    Reference
      API
      CLI
  • •Hierarchy comes from indentation alone.
  • •Node shapes work like flowcharts: (( )) circle, [ ] square.

Timeline

timeline

Release history, roadmaps, events in order.

timeline
    title Project history
    2024 : First release
    2025 : Plugin API : 1.0
    2026 : Cloud sync
  • •Each line is period : event; add more events with extra : separators.

Git graph

gitGraph

Branching strategies and release workflows in contributing guides.

gitGraph
    commit id: "init"
    branch feature
    checkout feature
    commit id: "add login"
    checkout main
    merge feature
    commit id: "v1.0"
  • •The default branch is main.
  • •Use tag: "v1.0" on a commit to label a release.

User journey

journey

UX flows with a satisfaction score per step.

journey
    title Signing up
    section Discover
      Find the site: 5: User
      Read the docs: 3: User
    section Sign up
      Fill the form: 2: User
      Confirm email: 4: User
  • •Each task is name: score (1–5): actors.

Quadrant chart

quadrantChart

Prioritization matrices (impact vs. effort).

quadrantChart
    title Feature priority
    x-axis Low effort --> High effort
    y-axis Low impact --> High impact
    quadrant-1 Plan
    quadrant-2 Do first
    quadrant-3 Skip
    quadrant-4 Maybe
    Dark mode: [0.2, 0.8]
    Offline sync: [0.8, 0.7]
  • •Point coordinates run from 0 to 1 on both axes.

XY chart (bar & line)

xychart-beta

Small bar and line charts inside docs.

xychart-beta
    title "Weekly downloads"
    x-axis [Mon, Tue, Wed, Thu, Fri]
    y-axis "Downloads" 0 --> 500
    bar [120, 230, 310, 280, 450]
    line [120, 230, 310, 280, 450]
  • •Still marked beta in Mermaid — syntax may change.

Fix common Mermaid syntax errors

Most “Syntax error in text” messages come from one of these four mistakes.

Missing or misspelled diagram keyword

Breaks
flow TD
  A --> B
Works
flowchart TD
  A --> B

The first line must be an exact keyword: flowchart, sequenceDiagram, classDiagram, stateDiagram-v2, erDiagram, gantt, pie, mindmap, timeline, gitGraph, journey…

Special characters in unquoted labels

Breaks
A[Hello World (v2)] --> B
Works
A["Hello World (v2)"] --> B

Wrap labels containing parentheses, colons, or other punctuation in double quotes.

Using "end" as a node name

Breaks
flowchart LR
  start --> end
Works
flowchart LR
  start --> End

Lowercase "end" closes a subgraph and breaks the diagram. Capitalize it, or use a quoted label: done["end"].

Gantt dates not matching dateFormat

Breaks
dateFormat DD/MM/YYYY
Task :2026-01-15, 3d
Works
dateFormat YYYY-MM-DD
Task :2026-01-15, 3d

dateFormat must describe the dates you actually wrote, or tasks land in the wrong place or the chart fails.

Renders here but not on GitHub? See why Mermaid diagrams don’t render on GitHub.

Mermaid not rendering in your Markdown?

Paste the block into the editor above first: if it renders here, the diagram is fine and the problem is where you’re viewing it.

The block shows as plain code

The fence must be tagged exactly mermaid — three backticks followed by the word mermaid, at the start of the line. A tag like ```flowchart or ```graph is just a code block, and an indented fence is treated as part of a list.

It renders here but not in your editor

Most editors need a newer version or a plugin. VS Code needs 1.121 or later; JetBrains IDEs need the bundled Mermaid plugin switched on; Zed needs 0.225.0 or later; Sublime Text, Neovim, and Notepad++ need a plugin. See the full list in our editor guide.

It renders here but not on GitHub

GitHub upgrades its bundled Mermaid on its own schedule, so brand-new diagram types or options may work here first. Put a block containing just "info" on GitHub to see its version.

It shows a syntax error

Read the message — it normally names the line. The four mistakes above (misspelled keyword, unquoted punctuation, "end" as a node name, mismatched Gantt dates) cause most of them.

It works in the preview but not on your website

GitHub Pages (Jekyll), Hugo, and most static-site generators only pass the code block through; the site must load the Mermaid script itself.

GitHub-specific causes are covered in why Mermaid diagrams don’t render on GitHub.

Where Mermaid renders in Markdown

Write a diagram once and it displays in most places developers keep docs. Editor-by-editor shortcuts are in our Markdown preview in any editor guide.

GitHub```mermaid code blocks in .md files, issues, PRs, discussions, and wikis
GitLab```mermaid code blocks in Markdown
VS CodeBuilt-in Markdown preview since version 1.121
Visual Studio 2026Built-in Markdown preview renders Mermaid (with zoom controls); the 2022 editor needs the Markdown Editor v2 extension
JetBrains IDEsBundled Mermaid plugin — disabled by default; enable it under Settings → Plugins → Installed
ZedBuilt-in Markdown preview since Zed 0.225.0
Obsidian```mermaid code blocks in notes
Typora```mermaid code blocks render inline as you type
Sublime Text, Neovim, Notepad++Only through a plugin (MarkdownPreview with SuperFences, markdown-preview.nvim, Markdown Panel)
NotionCode block with the language set to Mermaid
GitHub Pages (Jekyll)Only if the site adds the Mermaid script itself

Mermaid vs. PlantUML vs. draw.io

Text-based diagrams suit docs that change with the code; visual editors suit one-off, free-form drawings.

FeatureMermaidPlantUMLdraw.io
Diagrams written as plain text
Renders natively in GitHub Markdown
Diffs cleanly in pull requests
Runs in the browser, no serverNeeds a server
Full UML coverageCommon diagramsDrawn by hand
Free-form visual editing

Frequently asked questions

Why is my Mermaid diagram not rendering in Markdown?

Check these in order: the code fence is tagged mermaid; the diagram has no syntax error (paste it into the editor above — errors show the failing line); and the place you are viewing it supports Mermaid in the version you have (VS Code 1.121+, Zed 0.225+, the JetBrains Mermaid plugin enabled, or a plugin in Sublime Text, Neovim, and Notepad++).

What is a Mermaid diagram?

Mermaid is an open-source JavaScript tool that turns text into diagrams. You describe nodes and connections in a simple syntax inside a ```mermaid code block, and it draws a flowchart, sequence diagram, Gantt chart, or one of a dozen other diagram types. Because the source is plain text, diagrams live next to your docs and change through normal pull requests.

How do I export a Mermaid diagram as an image?

In the preview above, every rendered diagram has SVG and PNG buttons in its header. SVG keeps it sharp at any size (best for docs and slides); PNG is a high-resolution image for chat apps and tools that don't accept SVG.

Does GitHub render Mermaid diagrams?

Yes. Since 2022 GitHub renders ```mermaid code blocks in .md files, issues, pull requests, discussions, and wikis. GitHub upgrades Mermaid on its own schedule; render a block containing just "info" on GitHub to see its version. This previewer uses Mermaid v11, so very new syntax may work here before GitHub.

Why does my diagram show a syntax error?

The usual causes are a misspelled diagram keyword on the first line, punctuation in an unquoted label, the reserved word "end" as a node name, or Gantt dates that don't match dateFormat. The error message usually names the line — fix that line first.

Mermaid or PlantUML?

Mermaid for documentation on GitHub, GitLab, and wikis: it renders natively and needs no server. PlantUML when you need complete UML notation and can run a rendering server or use its web service.

Is this Mermaid editor free and private?

Yes. Diagrams are rendered in your browser — nothing is uploaded — and your work is autosaved locally. Use Share to send a link that contains the diagram itself.

More Markdown Tools & Guides

All tools are free, run in your browser, and require no account.

Live Markdown PreviewerTool

Edit Markdown with a real-time preview, Mermaid, KaTeX math, drag-and-drop files, and one-click export.

Open the tool
GitHub Markdown PreviewTool

Load any public README, test it, and look up any GitHub syntax in the complete cheat sheet.

Open the tool
LaTeX Math PreviewTool

Typeset equations as you type, with a copy-ready KaTeX cheat sheet of 180+ commands.

Open the tool
README Template GeneratorTool

Pick sections, fill in your project, and download a GitHub-ready README.md with badges and a TOC.

Open the tool
AI Markdown ViewerTool

Paste ChatGPT, Claude, or Gemini output and read it formatted, with tables, code, and math.

Open the tool
What Is Markdown?Guide

A plain-English introduction: what Markdown and .md files are, where it came from, and where it is used.

Read the guide
Markdown in Google DocsGuide

Preview .md files in Drive, edit in Docs' Markdown mode, and paste, convert, or export Markdown.

Read the guide
Best Online Markdown ViewersGuide

Six free tools tested with the same document: rendering, privacy, and phone support compared.

Read the guide
GitHub Markdown Not Rendering?Guide

16 causes found by symptom — tables, lists, image paths, code fences, alerts, Mermaid, math — with tested fixes.

Read the guide
Markdown Preview in VS CodeGuide

Preview shortcuts, settings verified on VS Code 1.141, built-in Mermaid and math, extensions, and fixes.

Read the guide
How to Open an .md FileGuide

Open and read Markdown files formatted on Windows, Mac, Linux, iPhone, Android, Word, and Google Docs.

Read the guide
Markdown Preview in Any EditorGuide

Exact preview shortcuts for Visual Studio, JetBrains, Zed, Xcode, Sublime, Neovim, Obsidian, and more.

Read the guide
Preview Markdown in a BrowserGuide

Six free ways to read .md files in Chrome, Edge, Firefox, or Safari — compared for privacy and features.

Read the guide