Mermaid is a free, MIT-licensed JavaScript library that turns plain text into diagrams. You declare a diagram type (like flowchart TD), write one statement per line, and the renderer draws the picture as you type. This suite runs Mermaid 11 entirely in your browser β€” no signup, no server round-trip, and the SVG or PNG export is generated locally. GitHub, GitLab, and Notion render the same syntax natively, so what you build here pastes straight into a README.
Ad
Loading renderer…
Ad

Mermaid Diagram Types at a Glance

DiagramFirst lineBest for
Flowchartflowchart TDProcess steps, decisions, pipelines
SequencesequenceDiagramMessage order between services or people
ClassclassDiagramObject-oriented design, UML class models
Entity relationshiperDiagramDatabase schemas and table relations
StatestateDiagram-v2Lifecycle of one object or ticket
GanttganttTask schedules and dependencies
PiepieShare-of-total comparisons
Mind mapmindmapBrainstorms and topic trees

Direction codes for flowcharts: TD/TB top-down, LR left-right, BT and RL for the reverses. Mermaid ships more types beyond these eight (timeline, journey, quadrant, gitGraph, sankey); they use the same single-statement-per-line style.

What Syntax Does Each Diagram Type Use?

Every type shares the one-statement-per-line habit, but the arrows and brackets change from one to the next. This cheat sheet covers the pieces you'll reach for most, taken from the official Mermaid docs.

DiagramCore syntaxExample line
FlowchartShapes: [ ] box, ( ) rounded, { } decision, (( )) circle, [( )] database. Edges: --> arrow, --- line, -.-> dotted, ==> thick. Group with subgraph … end.A[Start] ==> B{OK?}
Sequence->> solid call, -->> dotted reply, -x cross at the end, -) async. Blocks: loop, alt/else, opt, par. autonumber numbers every message.W->>P: Charge card
Class<|-- inheritance, *-- composition, o-- aggregation, --> association, ..> dependency, <|.. realization.Shape <|-- Circle
Entity relationshipEnds: || exactly one, |o zero or one, }| one or more, }o zero or more. -- identifying, .. non-identifying. Attributes: type name PK, FK or UK.CUSTOMER ||--o{ ORDER : places
State[*] start and end, A --> B : event, state Name { } for composite states, <<choice>>, <<fork>> and <<join>>.Review --> Approved : approve
GanttdateFormat YYYY-MM-DD, section headings, tasks as name :tags, id, start, length. Start can be after id. Tags: done, active, crit, milestone.Build :crit, b1, after a1, 3d
Piepie title Your title, then one "Label" : value per slice. Add showData after pie to print the numbers."Mobile" : 62
Mind mapIndentation sets the hierarchy, and the first node is the root. Shapes: [ ] square, ( ) rounded, (( )) circle, {{ }} hexagon.root((Launch plan))

Only the first five types have a ready-made example in the dropdown. Gantt, pie and mind map code still renders here because the page loads the full Mermaid 11 library, so paste a sample from the docs and edit from there.

How the Diagram Suite Works

Diagrams-as-code replaces drag-and-drop canvas editors with a text format. The code is the source of truth: it diffs line by line in code review, lives in the same repository as the thing it documents, and regenerates the identical image on every machine. Mermaid is the format GitHub chose for native rendering inside Markdown, which is why so many teams already have it in their toolchain.

The three syntax rules

First, the opening line names the diagram type. Second, each following line makes one statement β€” declare a node, connect two nodes, or open a block like loop or alt. Third, IDs are separate from labels: you write A[Collect payment] once and refer to it as A afterward, which keeps long diagrams readable.

How to use this page

Pick an example from the dropdown or clear the editor and start typing. Rendering fires as you pause, and the status line under the editor shows Mermaid's own error message when something breaks, usually with the line number and a pointer to the spot it choked on. Fix the line and the preview redraws. The SVG export is what you want for documentation; PNG is handy for slides. For deeper dives into one diagram type, use the sequence diagram maker, class diagram maker, and ER diagram maker pages, which carry full syntax tables for their type.

A worked example

Here is the CI pipeline example from the editor, annotated. It renders a flowchart with 5 nodes and 5 arrows: commit feeds test, test splits on a decision diamond into a publish branch and a failure branch, and the notify step loops back to commit with a dashed retry edge.

Count the pieces and you can predict the drawing before it renders: five boxes or diamonds, five connections. That's the whole mental model β€” the code states the structure, and layout is automatic.

What Happens When You Click Each Button?

Here's how the page behaves, read straight from its code, so there are no surprises when you export or reload.

ActionWhat the page does
Typing in the editorWaits until you've paused for 400 ms, then re-renders. The Render button does the same thing on demand.
Picking an exampleReplaces everything in the editor with that example and renders it straight away. There's no undo prompt, so copy your own code first.
A syntax errorThe status line turns red and shows Mermaid's message. The preview keeps the last diagram that rendered successfully.
Download SVGSaves diagram.svg from whatever is in the preview, with an XML header added. No background is painted in, and it stays sharp at any size.
Download PNGSaves diagram.png at twice the diagram's natural size on a solid dark background (#0f1117), matching the preview.
Copy codeCopies the editor text to your clipboard. If the browser blocks clipboard access, the status line tells you to select the text by hand.
Reloading the pageNothing is kept. The editor goes back to the CI pipeline example, and nothing is written to local storage or a server.
First visitMermaid 11 loads from the jsDelivr CDN. If that's blocked, the status line says the library couldn't load.

Should I Export SVG or PNG?

For anything that lives on a screen and might get zoomed, pick SVG. It's a vector file, so lines and text stay crisp in a wiki, a design doc or a README. One catch: the suite renders with Mermaid's dark theme, so labels and lines come out in light colours, and the SVG has no background of its own. Drop it on a white page and some text can fade into the page. Check it once before you publish.

PNG is the safer pick for slides, tickets and chat. The page draws the diagram onto a dark canvas at 2Γ— size, so it looks clean on high-density screens and doesn't depend on the background behind it. You can't edit a PNG's text later, though, so keep the Mermaid source too. Paste it into a ```mermaid block in GitHub or GitLab Markdown and it renders there as well.

Common mistakes that break a render

Frequently Asked Questions

Is Mermaid free to use?

Yes. Mermaid is open-source JavaScript released under the MIT license, so it is free for personal and commercial use with no watermark. This page runs that same library entirely in your browser, and your diagram text is never uploaded anywhere.

How do I turn text into a diagram?

Declare the diagram type on the first line (flowchart TD, sequenceDiagram, classDiagram, or erDiagram), then write one statement per line. Nodes are connected with arrows like A --> B. The renderer draws the picture as you type, so you see syntax mistakes immediately instead of after an export.

Can I export the diagram as an image?

Yes. The buttons above the preview export the current diagram as an SVG file or a 2x-resolution PNG, both produced locally in your browser. The SVG stays crisp at any zoom for docs and wikis; the PNG drops straight into slides and chat apps.

What diagrams can Mermaid draw?

Flowcharts, sequence diagrams, class diagrams, ER diagrams, state diagrams, gantt charts, pie charts, mind maps, timelines, user journeys, quadrant charts, git graphs, and more. This suite ships dedicated pages for the four most-used types and loads the full library, so most other types paste in and render too.

Where is Mermaid natively supported?

GitHub, GitLab, and Notion all render Mermaid code blocks natively, and many documentation systems have plugins for it. That makes it a good format to keep in version control: the diagram is reviewable text, diffs show exactly which line changed, and anyone can regenerate the image.

Is my diagram saved if I reload the page?

No. The editor doesn't write anything to your browser's storage or to a server, so a reload puts the CI pipeline example back. Click Copy code before you leave and keep the text somewhere safe, ideally next to the project it documents.

Why does my PNG have a dark background?

The PNG export fills the canvas with the same dark colour as the preview, then draws the diagram at twice its natural size. That keeps the light text readable. If you need a transparent file, download the SVG instead, which has no background of its own.

Why is the old diagram still showing after I made a mistake?

When the code fails to parse, the page leaves the last good render in the preview and shows the error in red under the editor. Both download buttons export that last good diagram, so fix the error first if you want your latest change in the file.

Does the suite work offline?

Not on a first visit. The Mermaid library loads from the jsDelivr CDN when the page opens, and the status line warns you if that request is blocked. Once it's loaded, rendering and exporting happen in your browser and your diagram text isn't sent anywhere.