PlantUML to Mermaid

PlantUML to Mermaid converter (sequence and class diagrams)

In short

Paste a PlantUML sequence or class diagram and get the equivalent Mermaid code: participants, every arrow style, activations, alt/loop/opt/par fragments and notes for sequences; classes with members, stereotypes, generics, every relationship arrow and multiplicities for class diagrams. The conversion is a plain text transform in your browser. Constructs Mermaid cannot express are not silently lost — each one is listed in the conversion notes as dropped or approximated.

Mermaid code

Live preview

Runs in your browser — nothing is uploaded. The live preview downloads the Mermaid library (about 2.5 MB) from esm.sh on first use and renders locally.

Updated · by the ChartCraft team

How does PlantUML sequence syntax map to Mermaid?

Most sequence constructs have a direct equivalent; the differences are in the arrows (Mermaid distinguishes line style and head shape with different characters), in participant declaration order (participant alias as Label in Mermaid, the reverse of PlantUML), and in a handful of PlantUML-only features — dividers, delays, return, messages from outside the diagram — which the converter approximates or drops and reports.

ConstructPlantUMLMermaidConverter
Diagram wrapper@startuml … @endumlsequenceDiagramConverted
Titletitle Checkout flow--- title: Checkout flow --- front-matterConverted
Participant with labelparticipant "Web app" as Wparticipant W as Web appConverted (order swapped)
Actoractor "Shopper" as Uactor U as ShopperConverted
Boundary / control / entity / database / collections / queuedatabase "Orders" as Dparticipant D as OrdersApproximated — Mermaid has only participant and actor
Synchronous messageA -> B : msgA->>B: msgConverted (solid line, filled head)
Reply / dottedA --> B : msgA-->>B: msgConverted
Thin / asynchronous headA ->> B : msgA-)B: msgConverted (open head = async in Mermaid)
Dotted asynchronousA -->> B : msgA--)B: msgConverted
Reversed arrowA <- B : msgB->>A: msgConverted (sender and receiver swapped)
Lost messageA ->x B : msgA-xB: msgConverted
Circle / half headsA ->o B, A -\\ BA->>BApproximated — drawn with a normal head
Coloured arrowA -[#red]> B : msgA->>B: msgApproximated — colour dropped
Activationactivate A / deactivate Aactivate A / deactivate AConverted
Activation shortcutsA -> B ++ : call, B -> A -- : doneA->>+B: call, B->>-A: doneConverted
returnreturn resultB-->>-A: resultConverted using the open activation; approximated if none is open
Create / destroycreate B, destroy B, A -> B ** : newcreate participant B, destroy BConverted (Mermaid ≥ 10.3)
Alternativesalt cond … else cond … endalt cond … else cond … endConverted
Loop / optional / breakloop 3 times … end, opt … end, break … endsame syntaxConverted
Parallelpar … else … endpar … and … endConverted (else becomes and)
Critical regioncritical … else … endcritical … option … endConverted
Groupgroup My label … endrect rgb(245,243,238) … endApproximated — Mermaid has no labelled group
Note on a participantnote left of A : text, note right of A … end noteNote left of A: text (lines joined with <br/>)Converted
Note over participantsnote over A, B : textNote over A,B: textConverted
Note on the previous messagenote left : textNote left of <receiver>: textApproximated — attached to the participant
Divider== Phase 2 ==Note over First,Last: Phase 2Approximated — Mermaid has no divider
Referenceref over A, B : see XNote over A,B: ref: see XApproximated
Autonumberautonumber, autonumber 10 5autonumberConverted; start/step/format dropped
Box around participantsbox "Backend" #LightBlue … end boxbox Backend … endConverted; colour dropped
Delay / spacing..., ...5 min later..., |||—Dropped
Messages from outside[-> A : request, A ->] : done—Dropped
Comments' text, /' block '/%% textConverted / block comments dropped
Stylingskinparam …, hide footbox, !theme, !include—Dropped
sequenceDiagram
    autonumber
    actor U as Shopper
    participant W as Web app
    participant P as Payment API
    U->>W: Place order
    activate W
    W->>+P: POST /charge
    alt card accepted
        P-->>-W: 200 OK
    else card declined
        P-->>W: 402 Payment Required
    end
    W--)U: Show confirmation
    deactivate W

How does PlantUML class syntax map to Mermaid?

The relationship arrows are nearly identical in the two languages, and multiplicities use the same quoted-string form. The real differences are in members — PlantUML writes name : type, Mermaid writes type name and marks static/abstract with a $/* suffix — and in kinds: Mermaid has only class, so interfaces, abstract classes and enums become stereotype annotations such as <<interface>>.

ConstructPlantUMLMermaidConverter
Diagram wrapper@startuml … @endumlclassDiagramConverted
Class with bodyclass Account { -balance : double +deposit(amount : double) : void }class Account { -double balance +deposit(double amount) void }Converted — members re-ordered to type-first
Abstract classabstract class Shapeclass Shape { <<abstract>> }Converted
Interfaceinterface Drawableclass Drawable { <<interface>> }Converted
Enumenum Color { RED, GREEN }class Color { <<enumeration>> RED GREEN }Converted
Stereotypeclass Order <<entity>><<entity>> inside the bodyConverted; spot letter and colour dropped
Display nameclass "Shopping cart" as Cartclass Cart["Shopping cart"]Converted
Genericsclass Repo<T>class Repo~T~Converted
Static / abstract member{static} +count : int, {abstract} +run()+int count$, +run()*Converted
Visibility+ - # ~+ - # ~Same in both
extends / implementsclass Dog extends Animal implements PetAnimal <|-- Dog, Pet <|.. DogConverted to relationship lines
InheritanceAnimal <|-- Dogsame syntaxSame
RealizationPet <|.. Dogsame syntaxSame
CompositionCar *-- Enginesame syntaxSame
AggregationTeam o-- Playersame syntaxSame
Association / dependencyA --> B, A ..> B, A -- Bsame syntaxSame
Reversed arrowsDog --|> Animal, Engine --* Carsame syntaxSame
Multiplicities and labelsOrder "1" *-- "many" Item : containssame syntaxSame
Label direction markerA --> B : uses >A --> B : usesApproximated — the > / < marker is dropped
Direction hintsA -down-> B, A -[hidden]- BA --> BApproximated — hint dropped
Member outside the bodyAccount : +close()added to the class bodyConverted
Package / namespacepackage billing { … }namespace billing { … }Approximated — classes grouped; relations stay outside
Layout directionleft to right directiondirection LRConverted
Note on a classnote left of A : textnote for A "text"Approximated — side is ignored
Note on a relationA --> B note right : text—Dropped
Body separators--, ..—Dropped
Nesting, lollipops, crow's feetA +-- B, A ()-- B, A }-- BA -- BApproximated — plain line
Stylingskinparam …, hide empty members, #colour—Dropped
classDiagram
    class Shape {
        <<abstract>>
        +String name
        +area() double
    }
    class Drawable {
        <<interface>>
        +draw() void
    }
    class Circle {
        -double radius
        +area() double
    }
    Shape <|-- Circle
    Drawable <|.. Circle
    Canvas "1" o-- "*" Shape : contains

What do "dropped" and "approximated" mean in the conversion notes?

Every line of PlantUML that does not have an exact Mermaid equivalent produces one row in the notes table, with its line number, so you can check the result against the original instead of trusting it blindly.

ResultMeaningWhat to do
convertedThe construct exists in both languages with a different spelling; the meaning is preserved.Nothing.
approximatedMermaid has no exact equivalent; the closest construct was used (a divider became a spanning note, a database participant became a plain participant, a package became a namespace).Read the output once; adjust by hand if the approximation misleads.
droppedNo Mermaid equivalent and no sensible stand-in: delays, messages from outside the diagram, skinparam styling, notes on relations, body separators.Re-add styling with Mermaid %%{init}%% directives or classDef if you need it.

The converter covers the sequence and class subsets above. PlantUML activity, use-case, state, component and deployment diagrams are not converted; for those, describe the diagram in words in the AI diagram generator, or compare the two languages feature by feature on the PlantUML alternative and Mermaid alternative pages. A compact syntax reference for the output is the Mermaid cheat sheet.

Questions

Does the converter cover every PlantUML feature?

No — it covers the sequence and class diagram subsets listed in the two mapping tables, which is what most READMEs and design docs use. Every construct outside that subset is reported in the conversion notes as dropped or approximated with its line number, so nothing disappears silently. Activity, use-case, state, component and deployment diagrams are not converted.

Why do PlantUML's --> and Mermaid's --> mean different things?

In a PlantUML sequence diagram --> is a dotted (reply) arrow with a filled head; in Mermaid the same spelling is a dotted line with no head, and the filled-head reply is -->>. The converter maps by meaning: PlantUML -> becomes ->>, --> becomes -->>, and the thin PlantUML head ->> becomes Mermaid's open async head -).

Is the conversion done by an AI model?

No. It is a deterministic text transform — a few hundred lines of JavaScript that run in your browser — so the same input always gives the same output, nothing is sent to a server, and it works offline once the page has loaded. The preview uses the standard Mermaid library.

Why does the live preview need a 2.5 MB download?

The preview is rendered by the real Mermaid library (version 11) so that what you see is what GitHub, Notion or your docs site will draw. It is loaded from esm.sh only when you click Render preview or tick auto-render, and cached by the browser afterwards. The code conversion itself needs nothing extra.

What happens to multi-line notes and \n in messages?

Multi-line note … end note blocks are joined with <br/>, which Mermaid renders as line breaks. A literal \n inside a PlantUML message is converted to <br/> as well.

My participant names have spaces — will that break Mermaid?

No. Mermaid needs a single-token id for each participant, so "Order Service" -> "Mail Service" becomes participant Order_Service as Order Service and the message uses the alias; the label on the diagram keeps the spaces.

Can I convert Mermaid back to PlantUML?

Not on this page — it converts in one direction. For a diagram you want to keep editing without either syntax, open it in the ChartCraft studio, where you describe changes in plain English and export SVG or PNG; see the sequence and class diagram generators linked below.

Which Mermaid version is the output written for?

Mermaid 10.3 or newer. The output uses front-matter titles, create participant/destroy, box, critical … option, namespace and class X["label"], which older Mermaid (9.x and early 10.x) did not support. GitHub, GitLab, Notion and Obsidian all ship a recent version.

Related guides and generators

Rather describe the diagram in plain English? Open the studio.

Open the studio →