State diagram maker
MEMBERSShow the states one thing passes through and the events that move it between them, from a starting point to an end.
Diagram
Diagram
Full stop and comma move between shapes, arrows move the selected one, Enter writes its text, C starts a connection, Delete removes. Capital R, D, O, B, T, N, F or S adds a shape. K folds, P shows what leads to the shape, Command or Control with F searches.
Pick a shape above and press here, or open a template.
Source, live both ways
Source, live both ways
What Mermaid can hold
What Mermaid can hold
What Mermaid cannot hold is kept in the project. Editing the code changes only what the code says.
Found a bug or missing something? Write to us
How it works
Making a state diagram
A state is a condition that lasts, such as Paid or Sent, so it is named with an adjective or a past participle, not with an action. Each transition carries the event that causes it; UML adds a guard in square brackets and an effect after a slash: payment [amount correct] / send receipt.
Begin with Starting point and end with End point, both under More shapes. Then check that every state can be reached and that every state but the last has a way out. In the example, States of an order, an order can be cancelled while it is New or Paid, but not once it is Sent.
A state diagram follows one thing and what happens to it. When the subject is work that people do in order, a flowchart or a business process diagram fits better; when it is messages between parts of a system, a sequence diagram.
Help
FAQ
How is a state diagram written in Mermaid?
As stateDiagram-v2. Each state is a line state "Paid" as id, each transition id --> id with the event after a colon, and [*] stands for Starting point on the left of an arrow and for End point on its right. A diagram laid out from left to right also gets the line direction LR.
Are composite states, forks and choices supported?
Partly. A state marked <<choice>> becomes a Diamond, while <<fork>> and <<join>> become ordinary states. States inside a composite state are drawn beside it rather than in it, and the line that opens the composite state, notes and the -- separators of parallel regions are listed as read without an equivalent.
What is the difference between a state diagram and a state machine?
A state machine is the model: a finite set of states, the events that cause transitions and often the actions they trigger. A state diagram is its picture. David Harel extended such diagrams with nesting and parallel regions in 1987, and UML 2 calls them state machine diagrams.