ChatDiagram
Tools/NFA diagram maker

NFA diagram maker.

Make an NFA diagram by describing the language, alphabet or regular expression. The NFA generator draws the states, labelled transitions, epsilon moves and accepting states in the standard state-diagram form.

State DiagramEnter to send

Free account, no card · Export SVG, PNG or PDF

See it work

NFA diagram examples.

Same tool, four requests. Every drawing below is a real render.

What you type
Draw an NFA over a and b that accepts exactly the strings ending in ab: q0 loops on a and b, q0 can move to q1 on a, and q1 moves to accepting q2 on b.
Then tryAdd a dead state for a completed input that is rejected.Change the target suffix from ab to ba.
State diagram: Strings ending in ab
State diagram · OMG UML 2.5.1 §14 + Harel (1987) statechart · schematex-state

Rather start from a finished drawing? Browse 40 state diagram templates →

The drawing

What an NFA diagram is.

An NFA diagram is a state diagram for a nondeterministic finite automaton. Circles are states, arrows are transitions, an incoming arrow marks the start, and a double circle marks an accepting state.

Unlike a DFA, an NFA may take more than one transition on the same input symbol and may use epsilon transitions that consume no input. A string is accepted when at least one possible path finishes in an accepting state.

Standard
OMG UML 2.5.1 §14 + Harel (1987) statechart
Engine
schematex-state
Editable
Double-click text, drag nodes
Export
SVG · PNG · PDF
State diagram: What an NFA diagram is
Who uses it

Who uses NFA diagrams.

State diagram: Computer science studentsComputer science students

Regular-language exercises that show how a machine recognizes a suffix, prefix or substring.

State diagram: Theory instructorsTheory instructors

Small epsilon-NFA constructions that make a regular-expression union visible in class notes.

State diagram: Language and parser designersLanguage and parser designers

Alternative token prefixes drawn as branches before they are converted into an implementation.

How it works

How to make an NFA diagram in three steps.

01

Describe it

One paragraph is enough to start.

“Draw an NFA over a and b that accepts exactly the strings ending in ab: q0 loops on a and b, q0 can move to q1 on a, and q1 moves to accepting q2 on b.”
02

See the drawing

Drawn by the right engine.

State diagram: Strings ending in ab
03

Say what changes

Every edit keeps a version.

Add a dead state for a completed input that is rejected.
V2 · DRAWN FROM V1, NOTHING RETYPED
FAQ

Common questions

What is an NFA?

A nondeterministic finite automaton is a finite-state machine that may have several possible transitions for one input symbol. It accepts when at least one path through the machine ends in an accepting state.

How is an NFA different from a DFA?

A DFA has one next state for each state and input symbol. An NFA can branch to several states and can include epsilon transitions, but NFAs and DFAs recognize the same class of regular languages.

What is an epsilon transition?

An epsilon transition changes state without consuming a character from the input. It is commonly used to join or split branches when building an NFA from a regular expression.

How are accepting states shown?

An accepting, or final, state is shown with a double circle. The machine accepts only if some path ends in that state after all input is read.

Can I make an NFA from a regular expression?

Yes. Describe the expression and its alphabet, then name any grouping or alternation you want to make explicit in the state diagram.

Related tools

Other drawings for the same work.

Draw your first NFA now.

Free account, no card. Describe the language and see the state diagram in under a minute.

Open the editor