Mermaid · Diagrams
Mermaid vs PlantUML: syntax, setup and where each one renders
Both turn text into diagrams, and their sequence syntax is close. The practical difference is where they run: Mermaid is JavaScript that draws in the browser and is built into GitHub and GitLab, while PlantUML is a Java program that usually needs a server. Here are the same diagrams in both.
Updated
The same sequence diagram in both
PlantUML wraps every diagram in @startuml and @enduml and does not need a type line: it works out the type from the content. Its messages use -> and -->.
@startuml
Alice -> Bob: Authentication request
alt successful case
Bob --> Alice: Authentication accepted
else failure
Bob --> Alice: Authentication failure
end
@enduml
Mermaid starts with the type, sequenceDiagram, and writes messages with two arrowheads, ->> and -->>. The alt/else/end block is the same.
sequenceDiagram
Alice->>Bob: Authentication request
alt successful case
Bob-->>Alice: Authentication accepted
else failure
Bob-->>Alice: Authentication failure
end
Open this example in the editor (Mermaid vs PlantUML: the same sequence diagram).
Moving a sequence diagram from one to the other is mostly a search and replace of the arrows and the first and last lines.
The same class diagram
This is PlantUML's own example for its Smetana layout. In PlantUML, more dashes make a longer arrow:
@startuml
!pragma layout smetana
class Foo1
Foo1 --> Foo2
Foo1 --> Foo3
Foo1 ---> Foo4 : test 4
@enduml
In Mermaid the arrow length is not set by dashes; layout is automatic.
classDiagram
class Foo1
Foo1 --> Foo2
Foo1 --> Foo3
Foo1 --> Foo4 : test 4
Open this example in the editor (Mermaid vs PlantUML: the same class diagram).
Setup: Java, Graphviz, or a browser
| Mermaid | PlantUML | |
|---|---|---|
| Written in | JavaScript | Java |
| Runs | in the browser | plantuml.jar, a server, or Docker |
| Needs | nothing else | Java (11 or newer recommended); Graphviz for some diagrams |
| Licence | MIT | your choice of several: GPL, LGPL, Apache 2.0, BSD, EPL, MIT |
PlantUML needs Graphviz for use case, class, object, component, deployment and state diagrams and for the legacy activity syntax; other types do not use it. On Windows a compiled Graphviz is included. !pragma layout smetana switches to Smetana, PlantUML's Java port of Graphviz, so those diagrams render without installing Graphviz. PlantUML's site now also runs a JavaScript rendering engine in its online editor.
Where each one renders
| Mermaid | PlantUML | |
|---|---|---|
| GitHub | built in (mermaid code block) | not built in; PlantUML offers a browser extension |
| GitLab | built in, Mermaid 12 | Self-Managed: an administrator sets up a PlantUML server and enables it |
| Obsidian, VS Code preview | built in | not in their documentation |
That difference decides it for most teams: a mermaid block in a README renders on GitHub and GitLab for everyone, with no server to run.
Diagram types
Both cover the common ones: sequence, class, state, activity or flowchart, ER, Gantt, mind map and timeline. PlantUML has more UML types, such as use case, object, component, deployment and timing diagrams, and non-UML ones such as wireframes (Salt), network diagrams, JSON and YAML data, and regular expressions. Mermaid has types PlantUML does not list, such as git graphs, Sankey diagrams and quadrant charts. It also draws C4 diagrams with built-in keywords:
C4Context
title Online shop
Person(customer, "Customer")
System(shop, "Web shop")
System_Ext(pay, "Payment provider")
Rel(customer, shop, "Orders from")
Rel(shop, pay, "Charges cards via")
Open this example in the editor (Mermaid: C4 context diagram).
Which one to pick
Pick Mermaid when the diagram lives next to code or docs in GitHub, GitLab, Obsidian or a Markdown preview, and readers should see it without setup. Pick PlantUML when you need the UML types Mermaid does not have, or a team already runs a PlantUML server and has diagrams in it. Converting between them is manual; neither imports the other's syntax.
Mermaid in Confluence
Confluence Cloud does not render Mermaid on its own. Mermaid Studio for Confluence, our app, does: type /Mermaid on a page, write or paste the code with a live preview, or start from one of eight templates (flowchart, sequence, Gantt, class, ER, state, pie, mind map). The diagram follows Confluence's light or dark mode, or keeps one of five themes. Copying the SVG is free; Pro adds downloads as PNG or SVG and an AI that writes the Mermaid from a plain-English description. It runs Mermaid 11.17.2, and every example on this page renders there as written.
Limits
The Mermaid examples were rendered on 29 November 2026 with Mermaid 12.3.0, the version in our editor, and with 11.17.2, the version in Mermaid Studio. The PlantUML code is copied from PlantUML's documentation and was not run by us. Facts about each tool come from its documentation, read the same day.
Sources
- PlantUML: home page (supported diagrams)
- PlantUML: Quick Start Guide
- PlantUML: Graphviz installation
- PlantUML: Smetana (Graphviz ported to Java)
- PlantUML: Sequence diagram
- PlantUML: Download and licenses
- Mermaid documentation: Sequence diagrams
- Mermaid documentation: Class diagrams
- Mermaid documentation: C4 diagrams
- GitHub Docs: Creating diagrams
- GitLab Docs: PlantUML (administration)
- Atlassian Marketplace: Mermaid Studio for Confluence (version 3.10.0)
Questions and answers
Is Mermaid easier than PlantUML?
For the common diagrams the syntax is similar. Mermaid is easier to set up: it needs no Java and renders in GitHub, GitLab and many Markdown tools with nothing installed.
Does GitHub render PlantUML?
Not by itself. GitHub's diagram support covers Mermaid, GeoJSON, TopoJSON and STL; PlantUML offers a browser extension for GitHub.
Can I convert PlantUML to Mermaid?
Not automatically with either tool. Sequence diagrams convert easily by hand: change the arrows and the first and last lines.
Does PlantUML need Graphviz?
Only for some diagrams: use case, class, object, component, deployment, state and legacy activity. !pragma layout smetana avoids it.
How to cite this
Going Stellar (2026). Mermaid vs PlantUML: syntax, setup and where each one renders. GOING STELLAR S.R.L..
https://goingstellar.ro/methods/mermaid-vs-plantuml/