Mermaid Syntax Checker
Validate Mermaid code with the official parser. Errors are pinned to the exact line and explained in plain English, with a live preview once it's fixed.
- Checks as you type
- Line-level errors
- Fix hints
- Nothing uploaded
Mermaid code
Result
Loading…Loading the Mermaid parser…
A preview appears here once the code is valid.
How to check Mermaid syntax
- Paste your Mermaid code into the editor. The sample above has a deliberate mistake so you can see what an error looks like.
- Read the result. The checker runs the real Mermaid parser on every change. If something is wrong, the failing line is highlighted in red and the result panel explains the most likely cause.
- Fix and confirm. When the code is valid you get a green check and a live preview, so you know it will render in GitHub, GitLab, Notion, Obsidian or any other Mermaid-powered tool.
What the checker catches
Exact line numbers
The line that breaks the parser is marked in the gutter, so you don't have to hunt through a long diagram.
Plain-English hints
Instead of only Expecting 'SQE', got 'PS', you get the likely cause and the fix, with an example.
One-click fixes
Curly “smart” quotes pasted from Word, Slack or ChatGPT can be replaced with straight quotes in one click.
Every diagram type
Flowcharts, sequence, class, state, ER, Gantt, pie, mindmap, timeline, Git graph, C4 and more.
The most common Mermaid syntax errors
| Problem | Wrong | Right |
|---|---|---|
| Special characters in a label | A[Save (draft)] | A["Save (draft)"] |
| Reserved word as a node | A --> end | A --> E[end] |
| Single-dash flowchart arrow | A -> B | A --> B |
| Missing diagram type | A --> B | flowchart TD on line 1 |
| Curly quotes | A[“Hello”] | A["Hello"] |
| Generics in class diagrams | List<String> | List~String~ |
| Inline comment | A --> B %% note | %% note on its own line |
For a longer walkthrough with examples of each error, read how to fix Mermaid syntax errors. If your labels need line breaks or symbols, see line breaks and special characters in Mermaid.
Checking AI-generated Mermaid code
ChatGPT, Claude, Copilot and other assistants write Mermaid quickly, but they often add parentheses inside labels, use arrows from the wrong diagram type, or mix syntax from different Mermaid versions. Paste the output here before you commit it to a README or wiki. If the checker flags a line, you can usually fix it by quoting the label or correcting the arrow.
Frequently asked questions
How do I validate Mermaid syntax online?
Paste your code into the checker above. It runs the official Mermaid parser in your browser and shows either a green check with a preview, or the failing line with a hint for fixing it.
Which Mermaid version does the checker use?
Mermaid 10.9. Diagrams that pass here render on GitHub, GitLab, Notion, Obsidian and most other tools. Very new syntax added in Mermaid 11 may be reported as an error.
Why does my Mermaid diagram work here but not on GitHub?
GitHub sometimes runs a different Mermaid version and blocks some features, such as click handlers and certain HTML in labels. Remove interactive features and try again.
What does “Parse error on line X: Expecting …” mean?
The parser reached a character it did not expect on that line. The most common causes are unquoted special characters in a label, a misspelled keyword or a wrong arrow.
Is my code sent to a server?
No. Parsing and rendering happen entirely in your browser. Nothing you paste is uploaded or stored.
Can I check Mermaid syntax in CI?
Yes. Install @mermaid-js/mermaid-cli and run mmdc -i diagram.mmd -o /tmp/out.svg. A non-zero exit code means the diagram failed to parse.