Turing Machine Simulator
A Turing machine can read one symbol, write one symbol and step one cell. That is all of it — there is no arithmetic anywhere in the definition. Watching eight rules add one to a binary number is the quickest way to feel why such a limited device can compute anything computable: the arithmetic is not built in, it emerges from moving about on a tape.
What this generator does
Writes a random binary number to the tape and runs a machine of eight rules across three states until it halts, showing the state, tape and head position at each step. The machine runs right to the end of the number, then moves left flipping ones to zeros until it finds a zero to make a one.
How to use this tool
- Choose how many binary digits and generate a run.
- Read the rules: in this state, seeing this symbol, write that and move.
- Follow the trace — the highlighted cell is where the head is.
- Check the final tape as a binary number: it is the starting value plus one.
Understanding the controls
- How many binary digits
- Between 1 and 8. Longer numbers take more steps, and a run of ones takes the most, because every one must be flipped before the carry stops.
- Seed
- Any word reproduces exactly the same starting number and the same run.
Common use cases
- Teaching the theory of computation with a machine that does something recognisable
- Showing how a state table becomes behaviour
- Understanding why the halting problem is about machines like this
- Generating worked traces for a computer science course
- Setting the same run twice from a seed
How this generator works
The verification is genuinely independent of the machine. The run is replayed from the rules to confirm the tape and step count, and then the two tapes are read as binary numbers and compared — the output must be the input plus one. That second check knows nothing about states or transitions; it only knows arithmetic, which is exactly what makes it worth doing.
Randomness and fairness
The starting number on the tape is random; the machine's behaviour is entirely deterministic from there. A seed reproduces the same run exactly and is therefore explicitly not cryptographically secure. Without a seed the browser's cryptographically secure generator is used.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- One machine — binary increment. It is not a general simulator you can supply your own rules to.
- A single tape, infinite in both directions, with blanks written as underscores.
- The run is capped at 500 steps; this machine always halts long before that, but the cap is what makes the tool safe to run at all.
- Only the first eleven steps are traced, to keep the table readable.
- A run is gone once you leave the page — note the seed if a particular trajectory is worth returning to.
Privacy and your data
The machine runs entirely in your browser. Nothing about the tape or your seed is transmitted or kept.
Related generators
- DFA Minimisation GeneratorGenerates a finite automaton, merges the states no string can tell apart, and runs both machines over every short string to prove the language is unchanged.
- Sorting Algorithm Trace GeneratorAn array, an algorithm, and the state after every pass, with the comparison and move counts that distinguish the three.
- Context-Free Grammar Sentence GeneratorWrite your own grammar and derive sentences from it, with every sentence parsed back through your rules so nothing appears that they could not produce.
- State Transition Path GeneratorDescribe a state machine and walk random valid paths through it, to find the routes your tests are not covering.