How to make a Mermaid diagram online
- 1Type or paste Mermaid code into the editor.
- 2Start with a diagram keyword such as flowchart, sequenceDiagram or gantt.
- 3Watch the live preview and fix any syntax errors it reports.
- 4Copy a share link to send the diagram to someone else.
- 5Export the diagram as SVG or PNG.
What Mermaid is and why diagrams-as-code
Mermaid is an open-source JavaScript library that turns short text definitions into diagrams. Because the source is plain text, it can live in your repository, be reviewed in pull requests, and be diffed like any other code.
Changing a diagram means editing a line, not dragging boxes. Layout is automatic, which keeps diagrams consistent and fast to update.
Diagram types at a glance
The first line of the code picks the diagram type: flowchart for process flows, sequenceDiagram for interactions over time, classDiagram and erDiagram for data models, stateDiagram-v2 for state machines, and gantt for project schedules.
Mermaid also supports pie charts, mind maps, timelines and git graphs. Each type has its own page here with syntax tips and examples.
Tips for readable diagrams
Keep node IDs short and put the readable text in labels, for example A[Check order status]. Wrap labels that contain special characters in double quotes.
Lines starting with %% are comments. Use them to annotate sections of a large diagram without changing the output.