← Learn
Converter · step by step

Regular expression to NFA

Type a regular expression and watch Thompson’s construction assemble the NFA, one sub-expression at a time. Then open it in the simulator and run strings through it.

Try it — type any expression

Each step lights up the fragment built for one sub-expression, innermost first. Use + or | for union, * for repetition, ? for optional, and ε for the empty string.

1/9
try
NFA · being built
εεεεaaq0q1q2q3
a
One transition reading a.
How it works
1

A symbol becomes two states and one transition

The smallest fragment: an entry, an exit, and the symbol between them.

2

Concatenation chains fragments

The second fragment starts where the first one ends.

3

Union branches with ε-moves

An ε-move leads into each alternative, and an ε-move leads from each one to a shared exit.

4

Star adds a loop and a bypass

ε-moves let the inner fragment be repeated any number of times, or skipped entirely.

Questions

Which syntax is supported?

Juxtaposition for concatenation, + or | for union, * for Kleene star, ? for optional, parentheses, ε for the empty string and ∅ for the empty language. There is no “one or more” operator because + means union, as in most automata textbooks: write aa* instead.

Why does the NFA have so many ε-moves?

Thompson’s construction trades size for simplicity: every operator is handled the same mechanical way. Open the result and use Convert → To DFA, then Minimize, to get the compact machine.

Can I get a DFA directly?

Yes, in two clicks: open the NFA in the simulator, convert it to a DFA, and minimize.

More step-by-step tools