Diagram guides · Updated October 2026
Sequence diagram generator: who calls whom, and in what order
A sequence diagram is a transcript of a conversation drawn downwards. Each participant gets a column, time runs down the page, and every message is an arrow from one column to another. It is the right picture whenever the interesting part of a system is the handoff between two things rather than the logic inside either of them. This guide covers the notation, how to prompt for it, and why a diagram with twelve columns tells you nothing.
What you describe
A student submits a quiz. The web app saves the attempt to the database, then shows the score. Draw this as a sequenceDiagram.
What comes back
- Three columns with lifelines below them
- Labelled calls going out, replies coming back
- The Mermaid code, editable beside the preview
- A zoomable view and an SVG download
One diagram per answer, so ask for one scenario at a time.
What a sequence diagram shows that a flowchart cannot
A flowchart has one thread. It starts somewhere, branches, loops and ends, and the only question it ever answers is what happens next. That works while everything is happening in one place. The moment two separate things have to talk to each other, a flowchart has to flatten the exchange into a single line of boxes and the reader loses track of who is doing which bit.
A sequence diagram keeps the participants apart on purpose. Because each one owns a column, you can see at a glance that the browser is waiting while the server queries the database, and you can count how many round trips a single button press actually costs. That is information a flowchart physically cannot carry. If what you are drawing really does happen inside one program, the flowchart guide is the one you want instead.
The four things on the page
Note what is not on the list. There are no decision diamonds, no start and end nodes, and no arrows pointing back up the page. Time only runs one way, which is the constraint that keeps the diagram honest.
Calls, replies and activation
Mermaid distinguishes a call from a reply with a single character. A call uses one dash before the arrowhead, a reply uses two, and the reply draws as a dashed line. Activation is a matching pair of keywords around the stretch where a participant is busy:
sequenceDiagram participant S as Student participant W as Web app participant D as Database S->>W: Submit quiz activate W W->>D: Save attempt D-->>W: Attempt id W-->>S: Show score deactivate W
Reading that back: the student sends one message and waits, and during that wait the web app makes a round trip of its own. The activation bar on the web app column is the thing that makes the nesting visible. Without it the four arrows look like four unrelated events.
Declaring the participants at the top is optional but worth doing, because the declaration order sets the left-to-right order of the columns. Leave it out and the columns appear in whatever order the messages happen to mention them, which often puts the database in the middle and crosses every arrow on the page.
Branching and repetition, used sparingly
Two blocks cover most of what a student diagram needs. An alt block with an else branch shows one of two things happening, and a loop block shows something repeating. Both are closed with end:
sequenceDiagram
C->>S: Pay for order
alt Card accepted
S-->>C: Receipt
else Card declined
S-->>C: Error message
endResist stacking them. Each block draws a labelled frame around part of the diagram, and three nested frames leave so little room for the arrows that the picture stops being readable. If the scenario really has that much branching in it, the branching belongs in a flowchart and the conversation belongs here, as two diagrams that reference each other.
How to prompt for a sequenceDiagram
The generator on Flowchart Answers leans towards a top-down flowchart unless the prompt names a type, and a scenario written in prose gives it no reason to choose otherwise. Put the word sequenceDiagram in the request and the draft comes back with lifelines.
Then write the scenario the way you would narrate it to someone. List the participants first, then each exchange in order, and say explicitly where a reply is expected. A prompt such as the following works well: a sequenceDiagram with Customer, Checkout service and Payment provider, where Checkout sends an authorization request, the provider replies with an approval code, and Checkout confirms the order to the customer.
Naming the replies matters because a model left to itself will often produce a column of one-way arrows. For a model of what is stored rather than what is exchanged, the ER diagram guide covers the other half of most system assignments.
Edit the code rather than asking again
The Mermaid source sits beside the preview and you can change it in place, with the picture redrawing as you type. This is the fastest way to work. Re-prompting gives you a new diagram that differs in several ways at once; editing one line changes exactly the thing you meant to change, which on a sequence diagram is usually reordering two messages or swapping a call for a reply.
One syntax trap is worth knowing before it bites you. A label that contains a bracket or a quote has to be quoted itself, because Mermaid reads a bare bracket as structure. A node written as G[Sugar (food)] fails to parse, while G["Sugar (food)"] renders, and a single bad label takes down the whole diagram rather than just that one element. Message labels with awkward punctuation in them are where this turns up on a sequence diagram.
Four ways a draft goes wrong
When the shape is right, zoom the preview to check the labels have not collided, then download the SVG. If you also need to show who is allowed to start each of these conversations in the first place, that is a different diagram, and the use case guide covers it.
Sequence diagram FAQ
What is the difference between a sequence diagram and a flowchart?
A flowchart follows one thread of logic and asks what happens next. A sequence diagram follows a conversation and asks who said what to whom, in what order. The giveaway is the number of actors involved: if everything happens inside one program, draw a flowchart. If a browser talks to a server which talks to a database, the interesting information is in the handoffs, and only a sequence diagram shows those.
What do the solid and dashed arrows mean?
A solid arrowhead is a call: one participant asks another to do something. A dashed arrow is the reply coming back. In Mermaid the call is written with a single dash and two angle brackets, and the reply with two dashes and two angle brackets, so the difference is one character and very easy to get wrong. If every arrow on your diagram is solid, you have drawn eight requests and no answers.
What are the narrow vertical bars on a lifeline?
Those are activation bars, and they show the stretch of time where a participant is busy with a request rather than idle. They are added with activate and deactivate around the messages that happen while the work is in progress. They are optional, and they earn their place when something is waiting on something else, which is usually the point the diagram is being drawn to make.
How many participants should a sequence diagram have?
Around three to six. Every participant adds a column, and the columns are fixed width, so a diagram with twelve of them is wider than any page and every message becomes a long horizontal line that the eye cannot trace back to its sender. If you genuinely have twelve, draw the two or three that matter for this scenario and give the rest their own diagram.
How do I show an if or a loop?
Mermaid has blocks for both. An alt block with an else branch covers a decision, and a loop block covers repetition, each closed with end. Use them sparingly. A sequence diagram with four nested blocks has turned into a flowchart drawn sideways, and at that point the logic belongs in a flowchart and the conversation in a separate sequence diagram.
Do I have to declare the participants first?
Not strictly, because Mermaid will create a column the first time it sees a name. Declaring them is still worth doing for two reasons: the declaration sets the left-to-right order of the columns, which otherwise follows whoever happened to speak first, and it lets you give a short code a readable label.
Why did my request come back as a flowchart?
The generator defaults towards a top-down flowchart when the prompt does not name a type, and a description of a process reads the same way whether you wanted boxes or lifelines. Write the word sequenceDiagram into the prompt. If a draft still arrives in the wrong notation, edit the first line of the code rather than asking again.
Can I download the sequence diagram?
Yes, as SVG. It is a vector file, so a wide diagram with several participants stays legible when it is scaled down into a report. Zoom the preview first and check that no message label has run into the lifeline beside it, because that is the kind of collision that only shows up at full size.
Can I get a sequence diagram explained rather than drawn?
Yes, from the other direction. Photograph or screenshot the diagram in your lecture notes and run it through Image Summary, which describes what a chart or diagram is showing in plain language instead of only transcribing the labels on it.
Related diagram & flowchart guides
- AI flowchart generatorDescribe a process, get a flowchart.
- AI diagram generatorWhich diagram fits which question.
- How to draw a diagramPick a shape set and start somewhere.
- ER diagram generatorEntities, keys and relationships.
- Use case diagram onlineActors and what they can do.
Tools: Flowchart Answers · Video Answers · Ask Questions