Mermaid diagram types

Mermaid turns short text descriptions into diagrams. Each guide below explains what the diagram is for, shows a working example you can open in TryMermaid, and lists the syntax you need.

What is a Mermaid diagram?

Mermaid is a text language for diagrams. You write a keyword for the kind of diagram, then a line for each shape or connection, and Mermaid draws it. Because the diagram is plain text, it lives in version control beside your code and changes in a pull request like any other file.

Each diagram type has its own short syntax built for one job. Pick the type by what you want the reader to understand, not by how it looks: the groups below are sorted that way.

Which Mermaid diagram should I use?

Start from what you want to show. Every diagram type works in the TryMermaid code editor with a live preview, and flowcharts can also be edited on the visual canvas.

If you want to…UseMermaid keyword
Show the steps and decisions in a processFlowchartflowchart TD
Show messages between users, services or APIs over timeSequence diagramsequenceDiagram
Model classes in code and how they relateClass diagramclassDiagram
Design database tables and their relationshipsER diagramerDiagram
Describe the states of something and what changes themState diagramstateDiagram-v2
Brainstorm or outline ideas around one topicMind mapmindmap
Schedule tasks with dates and dependenciesGantt chartgantt
List events in chronological orderTimelinetimeline
Show how a total splits into partsPie chartpie title Where the marketing budget went
Explain a branching and release strategyGit graphgitGraph
Show how each step of an experience feelsUser journeyjourney
Compare items on two axes to decide priorityQuadrant chartquadrantChart
Show how a quantity flows and where it is lostSankey diagramsankey-beta
Plot values over a scale as bars or a lineXY chartxychart-beta
Lay out components on a grid you controlBlock diagramblock-beta
Document the bit layout of a binary formatPacket diagrampacket-beta
Trace requirements to what satisfies and verifies themRequirement diagramrequirementDiagram
Describe software architecture at one level of detailC4 diagramC4Context

Mermaid diagram FAQ

How many diagram types does Mermaid support?

More than 20. The guides here cover the 18 most widely used: flowchart, sequence, class, ER, state, mind map, Gantt, timeline, pie, Git graph, user journey, quadrant, Sankey, XY, block, packet, requirement and C4. Each one starts with its own keyword, such as flowchart or sequenceDiagram, on the first line.

Which Mermaid diagram should I use?

Start from what you want the reader to understand. Steps and decisions call for a flowchart; messages between systems over time call for a sequence diagram; database tables call for an ER diagram; dates and dependencies call for a Gantt chart. The table on this page maps each goal to its diagram.

Where do Mermaid diagrams render?

GitHub and GitLab render Mermaid inside Markdown code blocks, and so do many documentation and note-taking tools. Anywhere else, export the diagram as PNG or SVG, or share a link to it.

Is Mermaid free to use?

Yes. Mermaid itself is open source under the MIT licence. In TryMermaid every diagram type works on the free plan, with PNG and SVG export and up to 50 saved diagrams; you can start without an account.

Can I make Mermaid diagrams without writing code?

Flowcharts can be built by dragging shapes on the TryMermaid canvas, which writes the Mermaid code for you. The other types are written in code with a live preview, and each guide gives you a working example to start from.