Text & data

Sequence Diagram Maker

List who talks to whom and in what order. The diagram draws lifelines, arrows, activation bars and conditional blocks, and you can export it as SVG or PNG.

  • Diagrams render locally in your browser. Nothing is uploaded to a server.
Preview loading Mermaid… fit
Loading the diagram renderer (about 5.6 MB, cached after the first visit)…

How it works

1

Pick a Template (a simple save request, an OAuth login or a checkout with a payment provider) or start with sequenceDiagram.

2

Declare participants in the order you want them left to right, optionally with a display name: participant S as Server. Skipping this order and just writing messages also works; they appear in order of first use.

3

Write one message per line, Browser->>Server: POST /items, and use alt, loop or par blocks for branches, repetition and parallel work.

4

Turn on autonumber if you want to refer to steps by number, then export an SVG or a PNG at 1× to 4×.

A sequence diagram shows how participants (users, services, databases) exchange messages over time, with time running down the page. It is the natural diagram for an API call chain, an authentication handshake or a checkout. In Mermaid the order of the lines is the order of the arrows, so the text reads like the protocol you are documenting, and reordering two steps is a cut and paste.

Sequence Diagram Maker syntax cheat sheet

Participants and arrows

The arrow you choose carries meaning: solid versus dotted usually means request versus response, and the head says whether the call is synchronous.

SyntaxMeaning
participant A as AliceDeclare a participant with a display name. Declaration order sets the left to right order.
actor U as UserSame as participant, drawn as a stick figure.
A->>B: textSolid line, filled arrowhead: a synchronous call or request.
A-->>B: textDotted line, filled arrowhead: a reply or return value.
A->B: text   A-->B: textSolid or dotted line with no arrowhead.
A-xB: text   A--xB: textLine ending in a cross: a lost or failed message.
A-)B: text   A--)B: textOpen arrowhead: an asynchronous message, fire and forget.
A<<->>B: textArrowheads on both ends (Mermaid 11 and later).
A->>A: textA message to self, drawn as a loop on the lifeline.

Activation, grouping and numbering

Activation bars show when a participant is busy handling a request. Boxes and numbers help in long diagrams.

SyntaxMeaning
activate B   deactivate BDraw an activation bar on the lifeline of B.
A->>+B: call   B-->>-A: replyShorthand: + activates the target, - deactivates the sender.
autonumberPrefix every message with a running number.
box Aqua Backend … endDraw a coloured box around a group of participants.
create participant C   destroy CShow a participant being created or ended part-way down.

Blocks and notes

Blocks wrap a range of messages and end with end. They can be nested.

SyntaxMeaning
alt if … else otherwise … endAlternative paths, like if and else.
opt maybe … endA step that happens only under a condition.
loop every minute … endA repeated section.
par one and two … endMessages that happen in parallel; separate the branches with and.
critical … option … endA section that must succeed, with fallbacks as option lines.
break reason … endStops the enclosing flow when the condition holds.
rect rgb(240,240,255) … endA coloured background around some messages.
Note right of A: textA note beside a participant. Also left of, and Note over A,B: text to span two.

Habits that keep sequence diagrams useful

  • Declare participants first, in the order of the flow. A diagram where the actors jump around is harder to read than one that moves left to right.
  • Use dotted arrows for responses consistently, so the eye can find the replies.
  • Name messages with the real call (POST /token, reserveStock()) rather than prose, so the diagram can be checked against the code.
  • Keep one scenario per diagram. Show the happy path first and put error handling in alt or a second diagram.

Where the code renders

GitHub, GitLab and Obsidian render sequence diagrams from a fenced mermaid code block, which makes them well suited to design docs, pull request descriptions and API documentation. Notion shows them through a code block set to Mermaid. Sequence diagrams are among the oldest Mermaid diagram types and are widely supported, but newer features such as the bidirectional arrow or create and destroy need a recent Mermaid on the platform. For slides and tickets, export a PNG or SVG.

Text first, not drag and drop

This is a text-first sequence diagram maker. You cannot drag a lifeline to a new position or bend an arrow by hand. The order of the lines is the order of the messages, and the layout follows from it. For a protocol or an API flow that is a feature: the diagram is the specification in text form, it can be reviewed in a pull request, and it cannot get out of step with itself. If you need a free-form picture, use a drawing tool and keep this for the formal flows.

Export and sharing

Pick copy SVG or download SVG for a sharp vector file, or download PNG at 1×, 2×, 3× or 4× on a white, dark or transparent background. Share link compresses the code with lz-string and puts it in the URL fragment, the part after #, which browsers never send to a server. Your draft is saved in this browser's local storage, separately from the other diagram pages, so a refresh does not lose it. For other diagram types such as class, state, pie, timeline and git graph, use the full Mermaid editor.

Frequently asked questions

Frequently asked questions

What do the different arrow types mean?

->> is a solid line with a filled head, usually a synchronous call; -->> is the dotted version used for replies; -) is an open head for an asynchronous message; -x ends in a cross for a lost or failed message; -> and --> draw lines without heads.

How do I show an if/else or a loop?

Wrap the messages in a block and close it with end: alt valid … else invalid … end, opt for an optional step, loop for repetition, par … and … end for parallel messages.

How do I show a participant being busy?

Use activate B and deactivate B, or the shorthand + and - on the arrows: A->>+B: request and B-->>-A: response.

Can I number the steps?

Yes. Put autonumber on its own line before the first message and every arrow gets a running number, handy for referring to step 6 in a review.

Is my diagram uploaded anywhere?

No. Parsing, layout and export all happen in this page. The draft is kept in your browser's local storage, and a share link stores the diagram in the URL fragment, which browsers never send to a server.

Related tools