N
NJHTools

Sequence Diagram Online

Write participants and messages as plain text and get a sequence diagram that shows who calls whom and in what order, with live preview and SVG or PNG export. Free, no signup, and it runs in your browser.

Zoom
100%
Export
Mermaid code21 lines

Tab inserts spaces. Press Esc, then Tab, to move focus out. Autosaved in this browser.

PreviewLoading Mermaid…

Rendering…

Example sequence diagram code

This is the Mermaid source loaded in the editor above. Copy it into a Markdown file inside a ```mermaid block and GitHub, GitLab, Notion or Obsidian will render it.

sequenceDiagram
    autonumber
    actor U as User
    participant W as Web App
    participant A as Auth API
    participant D as Database

    U->>W: Submit login form
    W->>A: POST /login
    activate A
    A->>D: Find user by email
    D-->>A: User record
    alt Password matches
        A-->>W: 200 OK + session token
        W-->>U: Redirect to dashboard
    else Wrong password
        A-->>W: 401 Unauthorized
        W-->>U: Show "Invalid credentials"
    end
    deactivate A
    Note over W,A: All traffic over HTTPS

Sequence diagram syntax cheat sheet

SyntaxWhat it does
sequenceDiagramStart a sequence diagram.
participant A as AliasDeclare a participant box with a display name. Use actor for a stick figure.
A->>B: textSolid line with arrowhead (a call). A-->>B is dashed (a reply).
A-)B / A-xBAsync message (open arrow) / message ending in a cross.
activate A / deactivate AShow an activation bar. Shorthand: A->>+B and B-->>-A.
alt ... else ... endAlternative branches. Also loop, opt, par, critical and break blocks.
Note over A,B: textA note spanning participants. Also Note left of / right of A.
autonumberNumber every message automatically.

How to make a Mermaid sequence diagram

  1. 1Start the code with sequenceDiagram.
  2. 2Declare participants or actors in the order you want them shown.
  3. 3Write messages such as Client->>API: GET /orders.
  4. 4Add loops, alt blocks and notes to show logic.
  5. 5Export as SVG or PNG, or copy a share link.

Participants and message arrows

participant API declares a box; actor User draws a stick figure. Use participant A as Auth Service to give a short ID a longer display name. Participants appear left to right in the order they are declared or first used.

->> is a solid line with an arrowhead, typically a request; -->> is a dotted line, typically a response. -x ends in a cross for a failed or lost message, and -) draws an open arrow for async calls.

Activations, notes and numbering

Show when a participant is busy with activate API and deactivate API, or the shorthand Client->>+API: request and API-->>-Client: response.

Add Note right of API: text or Note over Client,API: text for context, and put autonumber on its own line to number every message.

Loops and alternatives

Wrap repeated messages in loop Every 30s ... end. Show branches with alt Success ... else Failure ... end, and optional steps with opt ... end.

par ... and ... end shows messages that happen in parallel, which is useful for fan-out calls to several services.

Frequently Asked Questions

How do I draw a response arrow in a Mermaid sequence diagram?↓

Use a dotted arrow: API-->>Client: 200 OK. Solid arrows (->>) are usually used for requests.

How do I number the messages?↓

Add autonumber on its own line right after sequenceDiagram. Every message after it gets a number.

How do I show an if/else in a sequence diagram?↓

Use alt Condition, then the messages, then else Other condition, more messages, and close with end.

Will this diagram render on GitHub, GitLab or Notion?↓

Yes, all three render Mermaid. On GitHub and GitLab, put the code in a fenced code block that starts with ```mermaid. In Notion, add a code block and set its language to Mermaid. Hosted platforms may run an older Mermaid version, so very new syntax can fail there.

How do I export the diagram as PNG or SVG?↓

Use the export buttons above the preview. SVG stays sharp at any size and suits docs and slides; PNG is a raster image that works anywhere images are accepted. Both are created in your browser.

How does sharing work, and is my diagram private?↓

The share link stores your diagram code in the URL hash, the part after #, which browsers do not send to servers. Nothing is uploaded, and your work is autosaved in your own browser. Anyone with the link can see the diagram, so share it only with people you trust.

Last updated: