Everything you need to create sequence diagrams — from first steps to advanced features.
WebSequenceDiagrams turns simple text into professional sequence diagrams. No drawing tools needed — just describe the interactions and the diagram is generated automatically.
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!
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.
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
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.
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.
| Syntax | Description |
|---|---|
A->B: text | Solid line, filled arrowhead |
A->>B: text | Solid line, open arrowhead |
A-->B: text | Dashed line, filled arrowhead |
A-->>B: text | Dashed line, open arrowhead |
A->(1)B: text | Slightly slanted (delayed) signal |
A->(5)B: text | Highly 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
( ) controls how slanted the arrow is.
Higher numbers create a steeper angle, implying a longer delay.
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.
participant Name participant "Long Name" as Alias
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
":Alice"->":Bob": Hello
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
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.
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
Group signals together to show control flow. All group types accept an optional text label that appears in the group header.
| Keyword | Purpose |
|---|---|
alt / else | Alternative paths (if / else if / else) |
opt | Optional block (may or may not execute) |
loop | Repeated execution |
par | Parallel execution marker |
seq | Strict 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
Add explanatory notes to your diagram. Notes can be placed left of, right of, or over one or more participants.
| Form | Description |
|---|---|
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 2end 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.
end note) are rendered exactly as written — they are not word-wrapped.
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.
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!
Display state information as a rounded box on a participant's lifeline.
The syntax mirrors the note keyword — just replace note with state.
state over Participant: STATE_NAME
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
Show when a participant is actively processing by highlighting its lifeline. There are two syntaxes: inline modifiers on signals and explicit keywords.
Append modifiers directly to the arrow to activate, deactivate, or create participants.
| Modifier | Effect |
|---|---|
A->+B | Activate the receiver (B) |
A->-B | Deactivate the sender (A) |
A->*B | Create participant B at this point |
A->*+B | Create and activate B |
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.
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
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
A->+B: Activate please B->-B: I'm deactivating now\n by myself
Reuse diagrams you've saved in your account by including them by filename. This avoids duplicating text and keeps complex flows manageable.
include "Diagram Name"
title LTE Call Flow include "LTE Attach procedure" include "LTE Call Setup"
Draw a reference box over one or more participants to summarize or refer to another sequence. Optionally, attach an incoming or outgoing signal.
ref over Participant1, Participant2
description text
end ref
ref over Mobile, Base Station
Refer to 3GPP 44.060 6.6.4.1
end ref
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
Show concurrent interactions using parallel { } blocks.
All signals inside a parallel block are drawn at the same vertical position,
indicating they happen simultaneously.
parallel {
A->B: message 1
C->D: message 2
}
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
}
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
}
}
Automatically prefix every signal with a sequential number.
Specify the starting number after the keyword.
Use autonumber off to stop numbering.
autonumber 1 autonumber off
autonumber 2 UE->GANC: Register Request GANC->UE: Register Reject