N
NJHTools

Mermaid Flowchart Maker

Type a few lines of Mermaid code and get a clean flowchart with automatic layout, live preview and SVG or PNG export. Free, no signup, and everything runs in your browser.

Zoom
100%
Export
Mermaid code17 lines

Tab inserts spaces. Press Esc, then Tab, to move focus out. Autosaved in this browser.

PreviewLoading Mermaid…

Rendering…

Example flowchart code

This is the Mermaid source loaded in the editor above. Copy it into a Markdown file inside a ```mermaid block and GitHub, GitLab, Notion or Obsidian will render it.

flowchart TD
    A([Start]) --> B[Open the signup form]
    B --> C{Email valid?}
    C -->|Yes| D[Create account]
    C -->|No| E[Show error message]
    E --> B
    D --> F[(Users DB)]
    D --> G[/Send welcome email/]
    G --> H([Done])

    subgraph Backend
        D
        F
    end

    classDef ok fill:#dcfce7,stroke:#16a34a,color:#14532d
    class D,H ok

Flowchart syntax cheat sheet

SyntaxWhat it does
flowchart TDStart a flowchart. Direction: TD/TB (top-down), LR, RL or BT.
A[Text]Rectangle node with id A. Other shapes: (rounded), ([stadium]), {decision}, [(database)], ((circle)), [/parallelogram/].
A --> BArrow from A to B. Also: --- (line), -.-> (dotted), ==> (thick), --x and --o (cross/circle ends).
A -->|label| BArrow with a text label. Equivalent form: A -- label --> B.
subgraph Name ... endGroup nodes inside a titled box.
classDef c fill:#f9f; class A cDefine a reusable style and apply it to nodes.
%% commentA line comment, ignored by the renderer.

How to make a Mermaid flowchart

  1. 1Start the code with flowchart TD for top-down or flowchart LR for left-to-right.
  2. 2Add nodes with an ID and a label, such as A[Start].
  3. 3Connect nodes with arrows such as A --> B.
  4. 4Label decisions with A -->|Yes| B and group steps in subgraphs.
  5. 5Export the flowchart as SVG or PNG, or copy a share link.

Direction and node shapes

The header sets the direction: TB or TD (top to bottom), BT (bottom to top), LR (left to right) and RL (right to left). LR usually fits better on wide screens and slides.

The brackets around a label set the shape: A[Rectangle], B(Rounded), C([Stadium]), D[(Database)], E((Circle)), F{Decision} for a diamond and G{{Hexagon}}. Use the diamond for yes/no decisions so readers recognise them instantly.

Arrows and link labels

--> draws an arrow, --- a plain line, -.-> a dotted arrow and ==> a thick arrow. Add text with A -->|label| B or A -- label --> B.

You can chain links on one line, as in A --> B --> C, and fan out with A --> B & C.

Subgraphs and styling

Group related nodes with subgraph Title ... end. Subgraphs can contain their own direction statement and can be linked to like nodes.

Define reusable styles with classDef highlight fill:#fde68a,stroke:#b45309 and apply them with class A highlight or the shorthand A:::highlight.

Frequently Asked Questions

How do I make a flowchart in Mermaid?↓

Start with flowchart TD, then write one connection per line, such as A[Start] --> B{Valid?} and B -->|Yes| C[Save]. The preview updates as you type.

What is the difference between graph and flowchart?↓

graph is the older keyword and still works. flowchart is the newer one and supports more features, so use flowchart for new diagrams.

How do I change the flowchart direction?↓

Change the header: flowchart LR for left to right, TD for top down, RL for right to left or BT for bottom to top.

Will this diagram render on GitHub, GitLab or Notion?↓

Yes, all three render Mermaid. On GitHub and GitLab, put the code in a fenced code block that starts with ```mermaid. In Notion, add a code block and set its language to Mermaid. Hosted platforms may run an older Mermaid version, so very new syntax can fail there.

How do I export the diagram as PNG or SVG?↓

Use the export buttons above the preview. SVG stays sharp at any size and suits docs and slides; PNG is a raster image that works anywhere images are accepted. Both are created in your browser.

How does sharing work, and is my diagram private?↓

The share link stores your diagram code in the URL hash, the part after #, which browsers do not send to servers. Nothing is uploaded, and your work is autosaved in your own browser. Anyone with the link can see the diagram, so share it only with people you trust.

Last updated: