NFA to DFA Converter

Department of Computer Science & Engineering | Automata Theory and Formal Languages

Define NFA

Sample Automata
Load pre-defined examples to explore different automata concepts

Strings ending with 'ab'

An NFA that accepts any string that ends with the substring 'ab'

States:

q0 (Start)
q1
q2 (Final)

Symbols:

a
b

Accepted Examples:

ab
aab
bab
ababab

Rejected Examples:

a
b
ba
aba

Strings containing 'aa'

An NFA that accepts any string that contains the substring 'aa'

States:

q0 (Start)
q1
q2 (Final)

Symbols:

a
b

Accepted Examples:

aa
aaa
baa
aab

Rejected Examples:

a
b
ab
ba
bab

Even number of 'a's

An NFA that accepts strings with an even number of 'a's

States:

q0 (Start) (Final)
q1

Symbols:

a
b

Accepted Examples:

""
b
aa
bb
aabb
abab

Rejected Examples:

a
ab
ba
aaa

States

Input Symbols

Transitions

Current Transitions

Convert Regular Expression to NFA
Enter a regular expression to convert it to an NFA using Thompson's construction
Common Regex Patterns
Select a regex pattern to use as an example

a

Matches a single character 'a'

Matches:

a

Non-matches:

b
aa

ab

Matches the sequence 'ab'

Matches:

ab

Non-matches:

a
b
ba

a|b

Matches either 'a' or 'b'

Matches:

a
b

Non-matches:

ab
c

a*

Matches zero or more 'a's

Matches:

""
a
aa
aaa

Non-matches:

b
ab

a+

Matches one or more 'a's

Matches:

a
aa
aaa

Non-matches:

""
b
ab

a?

Matches zero or one 'a'

Matches:

""
a

Non-matches:

aa
b

(a|b)*

Matches any sequence of 'a's and 'b's (including empty string)

Matches:

""
a
b
ab
ba
aab
abb

Non-matches:

c
abc

NFA Visualization

Add states to see the NFA graph
NFA Legend
Color coding for states and transitions

States

Regular State
Start State
Final State
Start & Final State

Transitions

Regular Transition
Self-Loop
Multiple Symbols

Badges

From
From State
To
To State
a → bTransition Symbol

DFA Visualization

Convert an NFA to see the DFA graph

Minimized DFA Visualization

Convert an NFA to see the DFA graph

Conversion Steps