Mermaid.js v10+ Rendering Engine

Mermaid Diagram Preview & Flowchart Tester

Real-time Mermaid diagram Markdown viewer and previewer. Write diagram code in Markdown and preview flowcharts, sequence diagrams, class diagrams, Git graphs, and Gantt charts live — exactly as GitHub renders them.

GitHub-CompatibleClient-Side SVG
116 words955 chars52 lines
Why diagrams-as-code?

Never Export a Diagram PNG Again

Traditional diagrams — Visio, draw.io, Lucidchart — produce binary files that drift out of sync with your code. Mermaid diagrams live in plain text alongside your documentation, diff cleanly in pull requests, and render natively on GitHub without any image uploads.

Diagrams as Code

Mermaid diagrams are plain text. They live in your repo, get code-reviewed in PRs, and never go stale because they are part of the codebase itself.

Native on GitHub

GitHub has rendered Mermaid natively since May 2022. Your diagrams display in READMEs, Issues, Wikis, and Discussions without any plugins.

Instant Client Render

All rendering happens in your browser using the Mermaid.js SVG engine. No server round-trips, no image hosting — diagrams update as you type.

Complete Mermaid Diagram Types Reference

Copy any snippet into the live editor above to preview the rendered diagram instantly.

Flowchart

Most popular

Visualise processes, decision trees, and pipelines with directional graphs.

```mermaid
flowchart TD
  A[Start] --> B{Is it working?}
  B -- Yes --> C[Ship it!]
  B -- No --> D[Debug]
  D --> B
```
Tips
Use TD for top-down, LR for left-right
Shapes: [] rectangle, {} diamond, () rounded
Add labels on arrows with --text-->

Sequence Diagram

API docs

Show communication between participants over time — perfect for API and auth flows.

```mermaid
sequenceDiagram
  participant Browser
  participant Server
  participant DB
  Browser->>Server: GET /api/user
  Server->>DB: SELECT * FROM users
  DB-->>Server: User row
  Server-->>Browser: 200 OK
```
Tips
Use ->> for solid arrows, -->> for dashed
Add Note over Participant: text for annotations
activate/deactivate shows execution span

Class Diagram

OOP design

Model object-oriented relationships, inheritance, and interfaces in code design docs.

```mermaid
classDiagram
  class Animal {
    +String name
    +int age
    +speak() void
  }
  class Dog {
    +fetch() void
  }
  Animal <|-- Dog
```
Tips
Use <|-- for inheritance, *-- for composition
Prefix members: + public, - private, # protected
Add <<interface>> or <<abstract>> stereotypes

Git Graph

Dev workflows

Document branching strategies, release workflows, and git history in your project docs.

```mermaid
gitGraph
  commit id: "Init"
  branch feature
  checkout feature
  commit id: "Add login"
  checkout main
  merge feature id: "Merge"
  commit id: "Release v1.0"
```
Tips
Use branch <name> to create branches
Use merge <branch> to merge back
Add id: "label" to name commits

State Diagram

UI/FSM

Map application states and transitions for UI flows, auth states, and finite state machines.

```mermaid
stateDiagram-v2
  [*] --> Idle
  Idle --> Loading : fetch()
  Loading --> Success : data received
  Loading --> Error : request failed
  Error --> Idle : retry
  Success --> [*]
```
Tips
[*] represents initial and final states
Add : label on transitions for event names
Nest states with state S1 { ... }

Gantt Chart

Project planning

Create project timelines, sprint plans, and milestone roadmaps directly in Markdown.

```mermaid
gantt
  title Sprint Planning
  dateFormat YYYY-MM-DD
  section Backend
  API design      :done, 2024-01-01, 3d
  Implementation  :active, 2024-01-04, 5d
  section Frontend
  UI components   :2024-01-03, 4d
```
Tips
Use done, active, or crit status flags
dateFormat must match dates used in tasks
Sections group related tasks visually

Mermaid vs. PlantUML vs. draw.io

Compare diagram tool capabilities to choose the right tool for your documentation workflow.

FeatureMermaidPlantUMLdraw.ioMarkdownPreview.net
Flowcharts (flowchart TD/LR)Live SVG render
Sequence DiagramsInstant preview
Class DiagramsFull v10 syntax
Git GraphsBranch history
State Diagramsv2 syntax
Gantt ChartsDate-format aware
GitHub native rendering1:1 GitHub output
Live 2-way editingMarkdown + HTML sync
Export clean HTMLOne-click copy

Common Mermaid Syntax Errors & Fixes

Most Mermaid render failures trace back to one of these four patterns.

Missing or wrong diagram type keyword
❌ Wrong
```mermaid
flow TD
  A --> B
```
✅ Correct
```mermaid
flowchart TD
  A --> B
```

The keyword must be exact: flowchart, sequenceDiagram, classDiagram, gitGraph, stateDiagram-v2, gantt, erDiagram.

Unquoted node labels with special characters
❌ Wrong
A[Hello World (v2)] --> B
✅ Correct
A["Hello World (v2)"] --> B

Node labels containing parentheses, colons, or other special characters must be wrapped in double quotes to avoid parse errors.

Using HTML entities inside diagrams
❌ Wrong
A["User &amp; Admin"] --> B
✅ Correct
A["User & Admin"] --> B

Do not use HTML entities inside Mermaid diagrams. Write literal characters — entities are treated as literal text.

Incorrect date format in Gantt charts
❌ Wrong
dateFormat DD/MM/YYYY
Task :2024-01-15, 3d
✅ Correct
dateFormat YYYY-MM-DD
Task :2024-01-15, 3d

The dateFormat declaration must exactly match the date format used in task definitions. Mismatches cause the entire Gantt chart to fail silently.

Frequently Asked Questions

Everything you need to know about Mermaid diagrams in Markdown.

Explore More Markdown Tools

All tools are free, client-side, and require no account.