#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · THEORY OF COMPUTATION

DFA Simulator: Draw Your Automaton and Trace Any String

Type transitions to get a state diagram, then run strings through the DFA one symbol at a time.

  • 🔵 State diagram
  • ▶️ Step-by-step trace
  • 🧪 4 example DFAs

How to use the DFA Simulator

  1. 1. Define the DFAWrite transitions like q0 1 -> q1, plus the start and accept states.
  2. 2. Check the diagramIt redraws as you type. Missing moves are flagged.
  3. 3. Run a stringStep through to see each move and whether it ends in an accept state.

What a DFA is

A deterministic finite automaton is a machine with a finite set of states, an input alphabet, a start state, a set of accept states, and exactly one move for every state and symbol. It reads a string one symbol at a time, follows the matching move each time, and accepts the string if it ends in an accept state.

DFAs recognise exactly the regular languages, the same ones that regular expressions describe. They're used in lexers, input validation and protocol design, and they're a core topic in theory of computation (TOC) and compiler design courses.

The simulator checks your machine as you type: two different moves from the same state on one symbol isn't a DFA, so you'll see an error, and any missing move is listed as a warning (the string is rejected if it gets stuck there). Accept states are drawn as double circles and the current state is shown in orange.

Worked example

The first example accepts binary numbers divisible by 3. Its states q0, q1 and q2 stand for the remainder so far: reading bit b moves from remainder r to (2r + b) mod 3. The start and only accept state is q0.

Run 110 (six in decimal): q0 reads 1 → q1, reads 1 → q0, reads 0 → q0. It ends in q0, so the string is accepted; 6 is divisible by 3. Try 111 (seven): q0 → q1 → q0 → q1, which is rejected.

The other examples are strings ending in 01, strings with an even number of 0s, and strings containing "ab". Use them as templates for homework questions, and step through with Prev and Next to watch the highlighted state move around the diagram.

Frequently asked questions

Does it support NFAs or ε-moves?

No, this simulator is for DFAs only, with exactly one move per state and symbol.

Can symbols be longer than one character?

Yes. If any symbol is longer than one character, separate the input string's symbols with spaces.

How do I write the empty string?

Leave the input blank. It is accepted only if the start state is an accept state.

Is the dfa simulator free to use?

Yes, the dfa simulator is free and costs nothing. Running your first string shows a short form for your name and WhatsApp number one time; once that's done, this tool and every other Uncodemy tool open with no form.

More free tools

See all free tools