State Diagram Generator
List transitions between states and get a state machine diagram with events on the arrows.
Processed locally in your browser/ Your data stays in your browser.
What is State Diagram Generator?
A state diagram (finite state machine) describes the states an object or process can be in and the events that move it from one state to another. It is used for order lifecycles, UI flows, protocol handling and game logic.
In quick mode you write one transition per line, "From -> To: event", and use [*] for the start and end. The tool converts it to Mermaid stateDiagram-v2 code, aliasing names that contain spaces, and shows the generated code beside the diagram. You can also paste your own stateDiagram code with composite states, forks and notes, and set the layout direction.
How does it work?
- Write transitions such as "Idle -> Processing: submit", one per line; use [*] for the initial and final state.
- Or paste stateDiagram-v2 code for composite states, choices and notes.
- Choose the layout direction and a theme.
- Export SVG or PNG, or copy the generated Mermaid code.
Common use cases
- Modelling an order lifecycle: created, paid, shipped, delivered, cancelled.
- Documenting a UI or wizard flow with the event that triggers each screen change.
- Describing a network protocol or connection state machine.
- Planning game logic or a workflow engine before coding it.
Examples
Try this input in the tool above:
stateDiagram-v2
direction LR
[*] --> Idle
Idle --> Processing : submit
Processing --> Success : ok
Processing --> Failed : error
Failed --> Idle : retry
Success --> [*]Privacy
State Diagram Generator runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.
Limitations
The quick outline covers simple transitions only. Composite states, forks, joins, choices and notes need stateDiagram-v2 code. Mermaid draws the diagram but does not verify that the machine is complete or deterministic.
Frequently asked questions
How do I mark start and end states?
Use [*] as the source for the initial state ("[*] -> Idle") and as the target for the final state ("Done -> [*]").
Can state names contain spaces?
Yes. A name like "Waiting for payment" is declared as a labelled state with a generated id, so transitions stay valid Mermaid.
What is the difference between stateDiagram and stateDiagram-v2?
stateDiagram-v2 is the newer renderer with better layout and more features. The outline mode always generates v2 code.
Related tools
Mermaid Live Editor
A free-form Mermaid editor: type diagram-as-code and get a live rendered diagram you can export.
Markdown & Diagrams
Flowchart Generator
Describe a process one step chain per line and get a flowchart plus the Mermaid code behind it.
Markdown & Diagrams
Sequence Diagram Generator
Write one message per line and see who talks to whom, in order, as a sequence diagram.
Markdown & Diagrams
Class Diagram Generator
Write classDiagram code with classes, members and relations and see the UML diagram immediately.
Markdown & Diagrams
ER Diagram Generator
Describe your tables, keys and relationships as Mermaid erDiagram code and see the ER diagram instantly.
Markdown & Diagrams
Markdown Editor & Live Preview
Type or paste Markdown on one side and read the rendered result on the other, with instant document statistics.
Markdown & Diagrams