Reference Guide

Everything you need to create sequence diagrams — from first steps to advanced features.

Table of Contents

  1. Quick-Start Tutorial
  2. Comments
  3. Signals & Arrow Types
  4. Participants
  5. Actors
  6. Signal to Self
  7. Multiline Text
  8. Grouping: Loops & Conditionals
  9. Notes
  10. Extended Text Descriptions Premium
  11. States Premium
  12. Lifeline Activation & Destruction
  13. Including Other Diagrams Premium
  14. Reference Boxes Premium
  15. Parallel Sequences Premium
  16. Autonumbering Premium
  17. Footer Options Premium
Getting Started

Quick-Start Tutorial

WebSequenceDiagrams turns simple text into professional sequence diagrams. No drawing tools needed — just describe the interactions and the diagram is generated automatically.

Step 1 — Draw a basic message

To send a message from one participant to another, write the sender name, an arrow (->), the receiver name, a colon, and the message text. Participants appear automatically — you don't need to declare them first.

Alice->Bob: Hello Bob!
Bob->Alice: Hi Alice!

Step 2 — Add more detail

Use different arrow styles for different meanings, add notes for context, and group related messages with alt, loop, or opt blocks.

title Authentication Flow

Alice->Bob: Authentication Request
alt successful
    Bob->Alice: Authentication Accepted
else failure
    Bob->Alice: Authentication Rejected
end

note right of Bob: Bob checks\nhis credentials database.

Step 3 — Refine with participants and actors

Control the order and appearance of participants using participant and actor declarations.

actor User
participant "Web App" as W
participant Server

User->W: Click Login
W->Server: POST /auth
Server-->W: 200 OK
W-->User: Show Dashboard
Tip All the examples on this page are interactive (unless marked Premium). Edit the code and the diagram updates instantly!
Reference — Basics

Comments

Lines beginning with # are comments and are ignored by the renderer. Use comments to annotate your source text without affecting the diagram.

# This line is a comment and won't appear in the diagram.
Alice->Bob: This line will appear.

Signals & Arrow Types

A signal is a message from one participant to another. The arrow style conveys meaning — solid for synchronous calls, dashed for responses, and so on.

SyntaxDescription
A->B: textSolid line, filled arrowhead
A->>B: textSolid line, open arrowhead
A-->B: textDashed line, filled arrowhead
A-->>B: textDashed line, open arrowhead
A->(1)B: textSlightly slanted (delayed) signal
A->(5)B: textHighly slanted (very delayed) signal

Try them all below:

# This is a comment.

Alice->Bob: Filled arrow
Alice->>Bob: Open arrow
Bob-->Alice: Dotted line
Bob-->>Alice: Dotted line, open arrow
Alice->(1)Bob: Slightly delayed
Bob->(5)Alice: Highly delayed
Note The number inside ( ) controls how slanted the arrow is. Higher numbers create a steeper angle, implying a longer delay.

Participants

Participants are created automatically the first time they appear in a signal. If you want to control the order they appear in, or give them a shorter alias, declare them explicitly with the participant keyword.

Syntax

participant Name
participant "Long Name" as Alias

Ordering & aliasing

Declared participants appear left-to-right in the order they are declared, regardless of when they are first used in a signal.

participant Bob
participant Alice
participant "I have a really\nlong name" as L

Alice->Bob: Authentication Request
Bob->Alice: Authentication Response
Bob->L: Log transaction
Tip — colons in names If a participant name contains a colon, wrap it in quotes: ":Alice"->":Bob": Hello

Actors

Use the actor keyword instead of participant to display a stick-figure icon above the name — useful for representing people or external users.

actor User
participant Terminal

User->Terminal: Login

Signal to Self

A participant can send a signal to itself. The arrow loops back, which is useful for representing internal processing or self-calls.

Alice->Alice: This is a signal to self.\nIt also demonstrates \nmultiline \ntext.

Multiline Text

Use \n anywhere in a message or participant name to insert a line break. This works in signal labels, notes, participant names, and group headers.

Alice->Bob: First line\nSecond line\nThird line
participant "My Service\n(v2.1)" as S
Reference — Structure & Grouping

Grouping: Loops & Conditionals

Group signals together to show control flow. All group types accept an optional text label that appears in the group header.

KeywordPurpose
alt / elseAlternative paths (if / else if / else)
optOptional block (may or may not execute)
loopRepeated execution
parParallel execution marker
seqStrict sequential execution

End every group with the end keyword. Groups can be nested to any depth, and alt blocks can contain multiple else clauses.

Alice->Bob: Authentication Request
alt successful case
    Bob->Alice: Authentication Accepted
else some kind of failure
    Bob->Alice: Authentication Failure
    opt
        loop 1000 times
            Alice->Bob: DNS Attack
        end
    end
else Another type of failure
    Bob->Alice: Please repeat
end
Reference — Annotations

Notes

Add explanatory notes to your diagram. Notes can be placed left of, right of, or over one or more participants.

Syntax

FormDescription
note left of A: text Single-line note to the left
note right of A: text Single-line note to the right
note over A: text Note centered over one participant
note over A, B: text Note spanning multiple participants
note left of A
  line 1
  line 2
end note
Multiline note (preserves formatting exactly as written)
participant Alice
participant Bob

note left of Alice 
This is displayed 
left of Alice.
end note
note right of Alice: This is displayed right of Alice.
note over Alice: This is displayed over Alice.
note over Alice, Bob: This is displayed over Bob and Alice.
Note Multiline notes (using end note) are rendered exactly as written — they are not word-wrapped.

Extended Text Descriptions Premium

Add narrative explanations directly in your diagram by indenting text with a leading space. These appear as formatted paragraphs above the signals that follow, making your diagram self-documenting.

Syntax

 Lines starting with a space become explanatory text.
 They are rendered as paragraphs in the diagram.

Alice->Bob: The signal that follows the explanation
 You can explain the sequences that follow
 simply by indenting your explanations 
 with a space.
       
Alice->Bob: Wow!

States Premium

Display state information as a rounded box on a participant's lifeline. The syntax mirrors the note keyword — just replace note with state.

Syntax

state over Participant: STATE_NAME

Example — TCP handshake states

participant Client
participant Server
parallel {
    state over Server: LISTEN
    state over Client: CLOSED
}
Client->Server: SYN
parallel { 
    state over Client: SYN-SENT
    state over Server: SYN_RECEIVED
}
Server->Client: ACK
Reference — Lifelines

Lifeline Activation & Destruction

Show when a participant is actively processing by highlighting its lifeline. There are two syntaxes: inline modifiers on signals and explicit keywords.

Inline modifiers

Append modifiers directly to the arrow to activate, deactivate, or create participants.

ModifierEffect
A->+BActivate the receiver (B)
A->-BDeactivate the sender (A)
A->*BCreate participant B at this point
A->*+BCreate and activate B

Example — creation, activation, and destruction

User->+A: DoWork
A->*+B: <<createRequest>>
B->*+C: DoWork
C-->B: WorkDone
destroy C
B-->-A: RequestCreated
A->User: Done

Use the destroy keyword to terminate a participant. Its lifeline will end at the previous signal with an X mark.

Explicit activate / deactivate keywords

For more control, use the activate and deactivate keywords on separate lines. They apply to the participant named, starting from the previous signal.

Alice->Bob: Do some work!
activate Bob

Bob->Bob: Work routine
activate Bob
deactivate Bob

Bob->Alice: All done!
deactivate Bob

Multiple activations per signal

The explicit syntax lets you activate or deactivate multiple participants on a single signal.

A->B: 
activate A
activate B

B->C: 
deactivate A
deactivate B
activate C

C->C:
deactivate C
Important Activations and deactivations always attach to the previous signal. Notes and states cannot trigger deactivations. If you need a participant to deactivate without receiving a signal, use a signal-to-self:
A->+B: Activate please
B->-B: I'm deactivating now\n by myself
Reference — Advanced Features

Including Other Diagrams Premium

Reuse diagrams you've saved in your account by including them by filename. This avoids duplicating text and keeps complex flows manageable.

Syntax

include "Diagram Name"

Example

title LTE Call Flow

include "LTE Attach procedure"
include "LTE Call Setup"
Note The included diagram must be saved in your account. The diagram name is case-sensitive and must match exactly.

Reference Boxes Premium

Draw a reference box over one or more participants to summarize or refer to another sequence. Optionally, attach an incoming or outgoing signal.

Syntax

ref over Participant1, Participant2
    description text
end ref

Basic reference

ref over Mobile, Base Station
    Refer to 3GPP 44.060 6.6.4.1
end ref

Reference with input and output signals

Use an arrow into ref for input, and an arrow out of end ref for output.

Alice->ref over Bob, Mary: input
    refer to other diagram
end ref -->Alice: output

Parallel Sequences Premium

Show concurrent interactions using parallel { } blocks. All signals inside a parallel block are drawn at the same vertical position, indicating they happen simultaneously.

Syntax

parallel {
    A->B: message 1
    C->D: message 2
}

Example — proxy forwarding

parallel {
    Client->Proxy: Request
    Proxy->Server: Forwarded Request
    note right of Server: Web proxy in operation
}

Server->(3)Proxy: Reply
parallel {
    Client->(3)Proxy: 
    Proxy->(3)Client: Crossed messages
}

The serial keyword

Within a parallel block, use serial { } to define independent sequences of operations that run concurrently. Each serial block progresses top-to-bottom, but different serial blocks happen at the same time.

parallel {
    serial {
        Alice->Bob: Hello
        Bob->Alice: Hello    
    }

    serial {
        Eve->Carol: Hello
        Carol->Eve: Hello
    }
}   

Autonumbering Premium

Automatically prefix every signal with a sequential number. Specify the starting number after the keyword. Use autonumber off to stop numbering.

Syntax

autonumber 1
autonumber off

Example

autonumber 2
UE->GANC: Register Request
GANC->UE: Register Reject