Langton’s Ant
Run Langton’s ant and print what it builds: on a white cell the ant turns right, on a black cell it turns left, then it flips the cell and moves forward one cell. After a few hundred steps of simple shapes and about ten thousand of disorder, the ant starts building a highway; the tool finds it by itself: from step 9,978 the moves repeat every 104 steps, 2 cells across and 2 down each time. Type any rule of 2 to 12 letters L and R for ants with more colours (RLR, LLRR, LRRRRRLLR …), choose an open plane or a wrap-around grid, the start direction and the colours, and mark where the ant ends. Download a PDF, a 300 DPI PNG or an SVG with every cell as an exact rectangle. Nothing is uploaded.
100% private — everything runs in your browser. Everything runs in your browser; nothing is uploaded.
Print at 100% (Actual size). Real size prints on one sheet when the drawing fits; the check bar in the footer lets you confirm the scale. The SVG holds the drawing at the printed size.
Ant
Page
Runs in your browser with our own code: nothing you type is uploaded or saved. Every step of the ant and the highway check are worked out by our own code. You may use what you make here, including commercially, with no credit needed.
How to run and print Langton’s ant
- Pick a preset, or type a rule such as RL (Langton’s ant) or RLR.
- Set the number of steps and choose an open plane or a wrap-around grid.
- Choose the start direction, the colours and whether to mark the ant.
- Check the highway line under the preview, choose Fitted to one page or Real size and the paper.
- Download the PDF and print at 100% (Actual size), or the PNG or SVG.
What you can use it for
- Maths and computing lessons on simple rules with complex results
- Step-by-step worksheets of the first moves
- Posters of the highway and multi-colour ants
- Plotter, laser and vinyl art from the SVG
- Pixel and cross-stitch charts
- Trying your own rule strings
The 14 presets
| Preset | Rule | Steps | Grid | Coloured cells | Highway found by the tool |
|---|---|---|---|---|---|
| Langton’s ant (RL), 11,000 steps: the highway has started | RL | 11,000 | open plane | 834 | from step 9,978, every 104 steps, 2 cells left and 2 cells down |
| RL, first 500 steps | RL | 500 | open plane | 62 | none found |
| RL, 9,000 steps (before the highway) | RL | 9,000 | open plane | 632 | none found |
| RL, 20,000 steps: a long highway | RL | 20,000 | open plane | 1,872 | from step 9,978, every 104 steps, 2 cells left and 2 cells down |
| Worksheet: RL, first 12 steps on a 6 × 6 grid, real size 12 mm cells | RL | 12 | 6 × 6 wrap | 8 | not checked on a wrap-around grid |
| RL on an 80 × 80 wrap-around grid, 30,000 steps | RL | 30,000 | 80 × 80 wrap | 2,012 | not checked on a wrap-around grid |
| RLR (3 colours), 20,000 steps | RLR | 20,000 | open plane | 1,285 | none found |
| LLRR (4 colours), 20,000 steps | LLRR | 20,000 | open plane | 433 | none found |
| RLLR (4 colours), 20,000 steps | RLLR | 20,000 | open plane | 1,572 | none found |
| LRRRRRLLR (9 colours), 30,000 steps | LRRRRRLLR | 30,000 | open plane | 2,201 | none found |
| LLRRRLRLRLLR (12 colours), 30,000 steps | LLRRRLRLRLLR | 30,000 | open plane | 1,533 | none found |
| RRLLLRLLLRRR (12 colours), 30,000 steps | RRLLLRLLLRRR | 30,000 | open plane | 2,042 | none found |
| LR (the mirror image of RL), 11,000 steps | LR | 11,000 | open plane | 834 | from step 9,978, every 104 steps, 2 cells right and 2 cells down |
| RLR on a 200 × 200 wrap-around grid, 200,000 steps | RLR | 200,000 | 200 × 200 wrap | 5,932 | not checked on a wrap-around grid |
Every count is worked out by the tool from the cells it draws.
The first 10 steps of RL
| Step | Cell the ant is on | Turn | Moves | Ends at (x right, y down) |
|---|---|---|---|---|
| 1 | white | right | right | (1, 0) |
| 2 | white | right | down | (1, 1) |
| 3 | white | right | left | (0, 1) |
| 4 | white | right | up | (0, 0) |
| 5 | black | left | left | (−1, 0) |
| 6 | white | right | up | (−1, −1) |
| 7 | white | right | right | (0, −1) |
| 8 | white | right | down | (0, 0) |
| 9 | white | right | left | (−1, 0) |
| 10 | black | left | down | (−1, 1) |
The ant starts at (0, 0) facing up on an all-white grid.
When the highway starts
| Steps run (RL) | Highway from step | Repeats every | Each repeat moves | Full repeats in the run |
|---|---|---|---|---|
| 9,000 | not yet | – | – | – |
| 9,977 | not yet | – | – | – |
| 10,500 | not yet | – | – | – |
| 11,000 | 9,978 | 104 | 2 cells left and 2 cells down | 9 |
| 15,000 | 9,978 | 104 | 2 cells left and 2 cells down | 48 |
| 20,000 | 9,978 | 104 | 2 cells left and 2 cells down | 96 |
| 30,000 | 9,978 | 104 | 2 cells left and 2 cells down | 192 |
The tool looks for the shortest repeat in the colours the ant reads at the end of the run, then walks back to the first step where it holds. A repeat is only counted once it has lasted at least six times its length and at least 500 steps, which is why 10,500 steps is still “not yet”.
Multi-colour rules, 20,000 steps
| Rule | Colours | Coloured cells | Area visited (cells) | Highway found |
|---|---|---|---|---|
| RL | 2 | 1,872 | 241 × 211 | yes, from step 9,978 (every 104) |
| LR | 2 | 1,872 | 241 × 211 | yes, from step 9,978 (every 104) |
| RLR | 3 | 1,285 | 74 × 40 | no |
| LLRR | 4 | 433 | 25 × 32 | no |
| RLLR | 4 | 1,572 | 42 × 46 | no |
| LRRRRRLLR | 9 | 1,328 | 38 × 38 | no |
| LLRRRLRLRLLR | 12 | 1,245 | 52 × 42 | no |
| RRLLLRLLLRRR | 12 | 1,441 | 54 × 64 | no |
“No” means no repeat was found within these 20,000 steps; it says nothing about later steps.
What prints
| Download | What is in it |
|---|---|
| The cells fitted to one page or at real size, vector, with the step count, the highway line and a check bar | |
| PNG 300 DPI | The same sheet as a picture |
| SVG | The cells at the printed size as exact rectangles, one path per colour, with the ant ring and grid lines if shown |
For a cutter that needs DXF, use SVG to DXF.
Which tool to use
| You want | Use |
|---|---|
| An ant that turns on coloured cells, the highway, rule strings | Langton’s Ant (this page) |
| Cells that live and die by their neighbours | Conway’s Game of Life |
| Pixels you place by hand | Pixel Art Maker |
| Mandelbrot, Julia and line fractals | Fractal Generator |
| Square grids to draw on | Graph Paper |
Other tools: the Pixel Art Maker lets you draw cells by hand, the Fractal Generator renders fractals and Graph Paper prints grids.
More free tools
Grids, patterns and printables?
Drawing and print tools that run privately in your browser, with no sign-up and no watermark.
Frequently asked questions
What is Langton’s ant?
A very simple machine on a grid of black and white cells, invented by Chris Langton in 1986 (Physica D, volume 22). An ant sits on one cell and moves by two rules, and those rules alone build a surprisingly complex picture.
What are the rules?
On a white cell the ant turns 90° right (clockwise), on a black cell it turns 90° left, then it flips the colour of the cell it is on and moves forward one cell. Every cell starts white and the ant starts facing up. Our tests check the first 10 moves against a list worked out by hand, and every step against a separate walker of our own.
What is the highway?
Starting on an all-white grid, the ant makes simple, often symmetric shapes for a few hundred steps, then an irregular blob, and then it starts a highway: the same 104 moves over and over, each time 2 cells further along a diagonal. The Langton’s ant article on Wikipedia gives the disorder as lasting until step 9,977. The tool does not assume this: it checks the colours the ant reads and finds that they repeat every 104 steps from step 9,978 to the end of the run.
Does every start end in a highway?
Not known. The source notes that every finite start tried so far ends in the same highway, but that nobody has proved it for every start. This tool only reports what it finds in the steps you ask for.
What do the letters in RLR or LLRR mean?
They are the multi-colour extension studied by Greg Turk and Jim Propp: one letter per colour, R to turn right and L to turn left on that colour, and the cell moves on to the next colour each visit. Langton’s ant is RL in this naming. The tool accepts any rule of 2 to 12 letters and checks every turn against the letter of the colour the ant reads.
Why does LR look like RL in a mirror?
LR turns left where RL turns right, so it draws the mirror image of RL, cell for cell, as our tests confirm.
What is the wrap-around grid?
A grid whose left edge joins the right edge and top joins the bottom, so the ant never leaves it. The highway cannot run forever there: it comes back round and crashes into its own track. On the open plane the ant can go up to 30,000 steps; on a wrap-around grid of up to 200 × 200 cells, up to 200,000 steps.
How big can it go?
30,000 steps on the open plane and 200,000 on a wrap-around grid; every preset draws in under 2 seconds in our tests. The open plane is 2,048 cells across, and the run stops with a message if the ant reaches its edge.
Can it print at real size?
Yes, when the drawing fits on one sheet: choose Real size and set the cell size. Every printed cell is within 0.2 mm of its true place and size in our tests, on US Letter and A4, as long as you print at 100% (Actual size); the check bar in the footer lets you confirm the scale. Bigger drawings print fitted to the page.
Is it free?
Yes. There is no sign-up, no watermark and no limit.
Is anything uploaded?
No. Every generation, step and cell is worked out by JavaScript in your browser. Nothing you type or paste is sent anywhere or saved when you close the page.