Mermaid diagram types
Pick a diagram, read the syntax, and open a working example in the live editor. Each page covers when to use that diagram, the mistakes that break the parser, and how to export it.
Open the live editor · Export PNG, SVG, or PDF · Syntax cheat sheet
Which diagram should you use?
- A process or a decision belongs on a flowchart.
- Messages between services belong on a sequence diagram.
- Tables, keys, and cardinality belong on an ER diagram.
- Dates, durations, and dependencies belong on a Gantt chart. Ordered events without duration belong on a timeline.
- Classes and methods belong on a class diagram. Modes and the events that change them belong on a state diagram.
Flowchart
Design process flows, decision trees, and workflows with our intuitive flowchart editor.
Sequence Diagram
Visualize system interactions, API calls, and message flows between components.
Class Diagram
Design object-oriented structures with classes, interfaces, inheritance, and associations.
ER Diagram
Design database schemas with entities, attributes, and relationships. Import SQL CREATE TABLE statements to auto-generate diagrams, or write Mermaid ER syntax directly.
Gantt Chart
Plan projects, track timelines, and visualize task dependencies with Gantt charts.
State Diagram
Visualize state transitions, finite automata, and system behavior with state diagrams.
Pie Chart
Visualize data distributions and percentages with simple pie charts.
Mind Map
Brainstorm ideas, organize thoughts, and visualize concepts with mind maps.
User Journey Map
Visualize user experiences, satisfaction scores, and touchpoints across tasks and sections.
Quadrant Chart
Plot items on two axes to create priority matrices, competitive analyses, and strategic frameworks.
Requirement Diagram
Visualize system requirements, trace relationships, and document verification methods.
Git Graph
Visualize git branching strategies, merges, cherry-picks, and commit history.
C4 Diagram
Visualize software architecture at multiple levels with the C4 model — context, containers, and components.
Timeline Diagram
Build a Mermaid timeline from text. Edit the example below, preview your changes, or start with a worked example for your own milestones.
ZenUML Diagram
Write sequence diagrams with intuitive, code-like ZenUML syntax for clearer system interactions.
Sankey Diagram
Visualize flow quantities, energy transfers, and resource allocation with Sankey diagrams.
XY Chart
Build bar charts and line charts with custom data using simple Mermaid syntax.
Block Diagram
Design system architectures, hardware layouts, and component diagrams with flexible block arrangements.
Packet Diagram
Visualize network protocol headers, packet structures, and binary data formats.
Kanban Board
Visualize task boards, workflow stages, and project status with Kanban board diagrams.
Architecture Diagram
Visualize cloud infrastructure, service architectures, and system design with architecture diagrams.
Why write the diagram as text?
It lives in git
The source is plain text, so a diagram review looks like a code review. Paste the same source into the live editor when you want to see it render.
Preview while you type
Every type page opens with a rendered example. Change the source and the preview updates before you export.
Export PNG, SVG, or PDF
SVG stays sharp in docs. PNG fits slides. Free PNG files include a watermark; Pro removes it. See the export guide.