Start from a template

Mermaid code

Your code is processed entirely in your browser and never sent to a server.

Preview

Enter code or pick a template above to see your diagram.

What This Tool Can Do

Type Mermaid code and the diagram redraws as soon as you pause. Start from a template if you do not know the syntax yet. Everything runs in your browser, so internal design notes you paste in never leave your device.

  • ✅ Live preview: Redraws automatically when you stop typing
  • ✅ Five templates: Flowchart, sequence, Gantt, pie chart and class diagram
  • ✅ Works with any language: Labels in Japanese or other scripts render correctly
  • ✅ SVG and PNG export: Save in a format you can drop into a document
  • ✅ Error messages in the page: Syntax problems are explained where you are working
  • ✅ Browser only: Your code is never sent to a server

Use Cases

  • Checking how a flowchart will look before pasting it into a GitHub README or issue
  • Testing whether your syntax parses before embedding a diagram in Notion
  • Adding a process diagram to a deck without drawing lines by hand
  • Reviewing diagram changes as text diffs instead of redrawing them each time

How to Use

1

Pick a template or write your own code

The buttons under "Start from a template" drop sample code for that diagram type into the editor. Write directly once you know the syntax.

2

Edit while watching the diagram

The diagram redraws when you pause typing. If the syntax is wrong, the reason appears in the preview panel.

Switch the diagram theme to match the palette of the document you are writing.

3

Export as an image

SVG stays sharp at any size; PNG can be pasted anywhere as-is. Use "Copy code" if you only need the text.

For GitHub or Notion, copying the code beats exporting an image — you can still edit it later.

Mermaid Syntax Reference

The syntax worth learning first, grouped by diagram type. Paste any snippet straight into the editor to see what it does.

Jump to a diagram type:

Flowchart syntax (graph / flowchart)

The first line declares the direction: TD is top-down, LR is left-to-right.

Syntax What it draws
graph TD Declare a top-down diagram (TB is the same)
graph LR Declare a left-to-right diagram
A[受付] Rectangle node. A is the ID, the text in [] is the label
B(丸い箱) Rounded node
C{判定} Diamond node (used for decisions)
D((円)) Circle node (used for start and end)
subgraph 名前 … end Group nodes inside a labelled box

Wrap a label in double quotes — A["text"] — when it contains characters such as () or -.

Arrows and lines

The characters you use between nodes change how the connector is drawn.

Syntax What it draws
A --> B Solid arrow
A --- B Solid line without an arrowhead
A -.-> B Dotted arrow
A ==> B Thick arrow (for emphasising the main path)
A -->|承認| B Label the arrow
A -- 承認 --> B Alternative syntax for the same thing

Conditional branches (yes / no)

The usual shape is a diamond node with two labelled arrows leaving it.

Syntax What it draws
B{在庫あり?} Diamond node holding the condition
B -- はい --> C Branch taken when the condition holds
B -- いいえ --> D Branch taken when it does not
C --> E
D --> E
Merge the branches back together

Sequence diagram syntax (sequenceDiagram)

List the participants, then write their exchanges in order from top to bottom.

Syntax What it draws
sequenceDiagram Declare a sequence diagram (first line)
participant U as 利用者 Declare a participant and give it a display name
U->>W: 検索 Send a message with a solid arrow (a request)
W-->>U: 結果 Reply with a dotted arrow (a response)
Note over W,D: 補足 Add a note spanning several participants
alt 条件 … else … end Wrap an exchange that differs by condition
loop 3回 … end Wrap a repeated exchange

Gantt chart syntax (gantt)

Declare the date format, then list tasks under each section.

Syntax What it draws
gantt Declare a Gantt chart
dateFormat YYYY-MM-DD Set the format of the dates you type
axisFormat %m/%d Set how the axis labels are displayed
section 設計 Start a group of tasks
要件整理 :done, req, 2026-09-01, 5d A completed task (id req, five days from Sep 1)
画面設計 :active, design, after req, 7d A task in progress, starting after req for seven days
:crit, … Highlight the task as critical

A task line reads "label : state, id, start, duration". Writing after otherId as the start places it after that task.

Pie chart syntax (pie)

List labels and values; the percentages are calculated for you.

Syntax What it draws
pie title 内訳 Declare a pie chart and give it a title
"操作方法" : 42 A label and its value; percentages are calculated automatically
showData Write pie showData to show the raw values too

Class diagram syntax (classDiagram)

Describe the contents of each class separately from the relationships between them.

Syntax What it draws
classDiagram Declare a class diagram
class 注文 { … } Define a class with its fields and methods
+int 注文番号 A public field (- marks private)
+合計金額() int A method (parentheses make it render as a function)
A --> B An association; the arrow shows the direction of the reference
A <|-- B Inheritance (B extends A)
A "1" --> "*" B Show multiplicity (one to many)

Snippets follow Mermaid 11 syntax. See the official documentation for the full specification.

Worth Knowing Before You Start

Mermaid is a syntax for writing diagrams as text. It appeared in 2014 and is now supported out of the box by GitHub, Notion and other major services.

Where your diagrams work as-is

  • GitHub: Wrap the code in ```mermaid in a README, issue or pull request comment and it renders as a diagram
  • Notion: Set a code block's language to Mermaid, then switch it to preview
  • GitLab / Azure DevOps: Both render mermaid blocks inside Markdown
  • VS Code: An extension shows diagrams in the Markdown preview

Why text beats an image file

  • Diffs are readable: Diagram changes show up in code review, so you can see exactly what moved
  • It is searchable: Node names are text, so repository search finds what is inside a diagram
  • Edits are fast: Change one line instead of redrawing connectors

Labels with punctuation

Labels can use any script, including Japanese. Parentheses and colons inside a label can be read as syntax, so wrap those labels in double quotes — A["Setting (default)"] — to be safe. Doing the same for full-width brackets avoids surprises.

What this tool does not do

There is no save or share feature, because we do not keep your code on a server. Use "Copy code" to take the text with you when you want to continue later.

About the Mermaid Diagram Editor

The Mermaid Diagram Editor is a free web tool that renders flowcharts, sequence diagrams and other diagrams from Mermaid syntax, and exports them as SVG or PNG images.

Who it is for

Built for engineers who want diagrams in their design docs and READMEs, and for product folks who share flows and specs visually. It suits anyone who would rather write a diagram as text and review it as a diff than drag shapes around a canvas.

FAQ

It is both a syntax for describing diagrams as text and the JavaScript library that turns that text into a diagram. Flowcharts, sequence diagrams, Gantt charts and class diagrams can all be written in code instead of drawn by hand.

Yes. GitHub renders mermaid code in READMEs, issues and pull request comments, and Notion renders it when you set a code block's language to Mermaid. Check your syntax here, then use "Copy code" and paste it in.

Yes. Node names and messages render correctly in Japanese. If a label contains brackets or a colon, wrap it in double quotes — A["Setting (default)"] — so it is not read as syntax.

Instead of a diagram, the preview shows "Could not render the diagram", the error message returned by Mermaid and a hint to check your syntax. While the mistake is there, the previous diagram is not shown and SVG and PNG export are unavailable. Fix the code and the diagram is redrawn about 0.3 seconds after you stop typing.

Choose SVG when text must stay sharp at any size, and PNG when you want to paste the image straight into a document or chat. SVG also lets you tweak colours and text later in a vector editor.

📅 Last Updated: October 16, 2026