Finite State Machine Builder
Build finite automata visually. Add states and transitions, then test input strings with animated step-by-step processing. Works for both DFA and NFA machines.
Add states and transitions to build your machine
Build Machine
Test Input
Machine Properties
Reference Guide
Finite Automata
A finite automaton is a mathematical model of computation with a finite number of states. It reads an input string one symbol at a time, transitioning between states according to a set of rules.
Formally, a finite automaton is a 5-tuple:
where Q is the set of states, is the input alphabet, is the transition function, is the start state, and F is the set of accept states.
DFA vs NFA
A DFA (Deterministic Finite Automaton) has exactly one transition per state per symbol. For every state and every input symbol, the next state is uniquely determined.
An NFA (Nondeterministic Finite Automaton) allows multiple transitions for the same symbol from a single state. It accepts if any possible path leads to an accept state.
Both DFA and NFA recognize exactly the same class of languages, the regular languages. Every NFA can be converted to an equivalent DFA (though the DFA may have exponentially more states).
Transition Functions
The transition function defines how the machine moves between states. For a DFA it maps a state and input symbol to exactly one next state:
For an NFA, the transition function maps to a set of possible next states:
A transition is written as , meaning "from state , on input , go to state ".
Regular Languages
A language is regular if some finite automaton recognizes it. Regular languages are closed under union, intersection, complement, concatenation, and Kleene star.
Examples of regular languages include "binary strings divisible by 3", "strings ending in ab", and "strings with an even number of 0s". All of these can be expressed as regular expressions and recognized by finite automata.
Not all languages are regular. For instance, the language of balanced parentheses requires a pushdown automaton (stack), making it context-free but not regular.