figviz
Create diagram
AI-Powered

State Diagram Generator State Diagrams

Describe your system behavior in plain language and Figviz will produce a polished state diagram with correct UML notation. Ideal for state machines, protocol modeling, embedded systems, and software design.

UML State MachinesState TransitionsComposite StatesExport High-Res PNG

State Diagram Examples

Browse state machine examples or generate your own above

Order Processing State Machine

A full-lifecycle order state machine covering Pending, Confirmed, Processing, Shipped, Delivered, Cancelled, and Returned. Each transition arrow carries a descriptive event label such as payment verified, carrier assigned, or delivery confirmed, plus guard conditions that control when cancellation is permitted.

order-processinge-commercestate-machine

User Authentication States

An authentication state diagram that traces the complete login journey across Logged Out, Authenticating, Authenticated, Session Expired, Locked Out, and Password Reset. Transition labels capture credential submission, token validation, failed-attempt thresholds, and automatic session timeout handling.

authenticationsecurityuser-management

Traffic Light Controller

A traffic light controller state machine with Red, Green, and Yellow phases, each governed by a configurable timer. A composite pedestrian crossing state interrupts the Green phase early, and an emergency vehicle override can preempt normal cycling from any phase.

traffic-lightembedded-systemcontroller

Elevator System States

An elevator state machine capturing Idle, Moving Up, Moving Down, Door Open, Door Closing, and Emergency Stop. Transitions fire on floor requests, arrival sensors, door timers, and close-button presses. Guard conditions enforce directional logic, and the emergency path is reachable from every other state.

elevatorembedded-systemsafety-critical

TCP Connection States

A complete TCP connection state diagram aligned with RFC 793, tracing every state from CLOSED through the three-way handshake (SYN_SENT, SYN_RECEIVED, ESTABLISHED) and the full teardown sequence (FIN_WAIT_1, FIN_WAIT_2, CLOSING, TIME_WAIT, CLOSE_WAIT, LAST_ACK). Every transition arrow is annotated with the corresponding segment event.

tcpnetworkingprotocol

Vending Machine States

A vending machine state machine covering Idle, Accepting Coins, Item Selected, Dispensing, Returning Change, and Out of Stock. Transitions handle coin accumulation with a running total, product selection validated against the required price, dispense motor activation, and exact change calculation before returning to Idle.

vending-machineembedded-systemfinite-automata

Prompt templates you can copy

Start with one of these examples, then adapt the subject, labels, data, or layout for your own use.

Order Processing State Machine

A full-lifecycle order state machine covering Pending, Confirmed, Processing, Shipped, Delivered, Cancelled, and Returned. Each transition arrow carries a descriptive event label such as payment verified, carrier assigned, or delivery confirmed, plus guard conditions that control when cancellation is permitted.

Create a professional UML state diagram for an order processing system. States: Pending, Confirmed, Processing, Shipped, Delivered, Cancelled, Returned. Transitions: Pending to Confirmed (payment received), Confirmed to Processing (warehouse picks), Processing to Shipped (carrier assigned), Shipped to Delivered (delivery confirmed). Cancelled reachable from Pending, Confirmed, Processing with guard conditions. Returned from Delivered within 30 days. Initial and final pseudo-states, standard UML rounded rectangles, white background

User Authentication States

An authentication state diagram that traces the complete login journey across Logged Out, Authenticating, Authenticated, Session Expired, Locked Out, and Password Reset. Transition labels capture credential submission, token validation, failed-attempt thresholds, and automatic session timeout handling.

Create a UML state diagram for user authentication. States: Logged Out, Authenticating, Authenticated, Session Expired, Locked Out, Password Reset. Transitions: Logged Out to Authenticating (credentials submitted), Authenticating to Authenticated (valid credentials), Authenticating to Logged Out (invalid credentials), Authenticated to Session Expired (timeout), Session Expired to Logged Out (auto redirect), Authenticating to Locked Out (3 failed attempts), Locked Out to Logged Out (after 15 min), any state to Password Reset (reset requested). Standard UML state notation, white background

Traffic Light Controller

A traffic light controller state machine with Red, Green, and Yellow phases, each governed by a configurable timer. A composite pedestrian crossing state interrupts the Green phase early, and an emergency vehicle override can preempt normal cycling from any phase.

Create a UML state diagram for a traffic light controller. Main states: Red (45s), Green (30s), Yellow (5s). Cyclic transitions: Red to Green (timer expires), Green to Yellow (timer expires), Yellow to Red (timer expires). Add a composite state for Pedestrian Crossing activated by button press during Green, which triggers Yellow early. Add Emergency Override state reachable from any state when emergency vehicle detected, returning to Red after override ends. Include entry/exit actions for each state, standard UML notation, white background

Elevator System States

An elevator state machine capturing Idle, Moving Up, Moving Down, Door Open, Door Closing, and Emergency Stop. Transitions fire on floor requests, arrival sensors, door timers, and close-button presses. Guard conditions enforce directional logic, and the emergency path is reachable from every other state.

Create a UML state machine diagram for an elevator system. States: Idle, Moving Up, Moving Down, Door Open, Door Closing, Emergency Stop. Transitions: Idle to Moving Up/Down (floor requested, guard: direction check), Moving to Door Open (floor reached), Door Open to Door Closing (timer 5s or close button), Door Closing to Idle (no pending requests), Door Closing to Moving Up/Down (pending requests in direction). Emergency Stop reachable from any state (emergency button or sensor fault), returns to Idle after reset. Include entry actions, standard UML notation, white background

What Is a State Diagram?

A state diagram (sometimes called a statechart or state machine diagram) is a visual model that captures every condition an object, system, or process can occupy and maps the transitions that move it from one condition to another when specific events occur. The concept traces back to finite automata theory and was formalized for software through David Harel's statecharts in the 1980s, later becoming a first-class diagram type in the Unified Modeling Language (UML). Engineers, architects, and analysts rely on state diagrams to reason about reactive systems, embedded controllers, communication protocols, and business workflows. Each rounded-rectangle node represents a stable condition, and each directed arrow represents a change triggered by an event, a fulfilled condition, or an elapsed timer.

UML State Machine Diagrams Explained

UML state machine diagrams build on the basic state diagram with a rich set of modeling constructs. A simple state is drawn as a rounded rectangle that may contain compartments for the state name, internal activities (entry, exit, do), and internal self-transitions that fire without changing state. Transition arrows carry a label structured as "event [guard] / action" where the guard is an optional boolean condition and the action is executed when the transition fires. Composite (hierarchical) states group sub-states inside a containing boundary, enabling a parent state to encapsulate complex nested behavior. Concurrent (orthogonal) regions divide a composite state with dashed lines so that multiple independent sub-machines run in parallel. Additional pseudo-states handle control flow: the initial pseudo-state (filled circle) marks the starting point, the final state (circled dot) signals termination, choice pseudo-states (diamonds) branch on conditions, and history pseudo-states (H) restore the last active sub-state on re-entry.

When to Use State Diagrams

Reactive systems: Capture objects that respond differently to identical events depending on their current condition, such as UI widgets, protocol handlers, or game entities whose behavior shifts with context
Embedded and real-time systems: Define deterministic behavior for controllers, sensors, and actuators where transitions must fire reliably under timing constraints
Protocol specification: Document communication protocols where connection states and message ordering must be precise and unambiguous for implementors and reviewers alike
Business process workflows: Map multi-stage processes such as order lifecycles, approval chains, or insurance claims where defined rules govern movement between stages
User interface design: Lay out navigation paths, wizard steps, authentication screens, and modal states to guarantee full coverage of every possible user interaction
Game development: Specify character behaviors, top-level game modes (menu, playing, paused, game over), and AI decision machines for non-player characters

How to Create a State Diagram

Building a state diagram starts with choosing the entity whose behavior you need to model and enumerating every stable condition it can occupy. For each state, note what must be true for the entity to enter it and what side effects occur on entry, during residence, or on exit. Then list every event that can arrive, determine which state each event fires from, and specify the destination state for each transition. Add guard conditions wherever a transition should only fire when a data value or external condition is satisfied. Review the finished set of states for completeness: every state except terminal ones needs at least one outgoing transition, and every state should be reachable from the initial state. For diagrams that grow complex, group related sub-states inside composite states and separate independent behaviors into concurrent regions. Figviz's AI state diagram generator handles all of this layout and notation automatically so you can go from a plain-language description to a polished, standards-aligned diagram in seconds.

State Diagram vs Flowchart: Key Differences

State diagrams and flowcharts both use shapes connected by arrows, but they answer different questions. A flowchart traces the steps of a process or algorithm from a start point to an end point, using decision branches to choose between alternative paths. Control flows forward, and each step is typically visited at most once per execution. A state diagram captures the persistent conditions of a living entity and how incoming events shift it between those conditions. The same state can be visited multiple times across the lifetime of the entity, making the model inherently cyclical rather than linear. A flowchart asks 'what sequence of steps should execute?' A state diagram asks 'given that this entity is currently in condition X, how should it respond to event Y?' Use a flowchart for procedures and batch algorithms; use a state diagram for long-lived objects, reactive components, and protocols where the same entity continues to exist and change condition over time.

Frequently asked questions

Figviz provides a free AI-powered state diagram generator that turns a plain-text description of your system into a clean, standards-aligned UML state machine diagram in seconds. Describe the states, transitions, and events you need and the tool handles all layout, notation, and labeling automatically. No manual drawing, no complicated diagramming software setup. It is particularly useful for software engineers, system designers, embedded developers, and students who need accurate state machine visuals quickly.

Make your own state diagram with Figviz

Create a free account and get starter credits to generate your own. No credit card required.

Sign up free →