This free online Langton's ant simulator runs one of the most famous cellular automata: an ant walks on a grid of white cells, turning right on a white cell and left on a black cell, and flipping the color of every cell it leaves. From that tiny rule comes a surprise: after about 10000 steps of chaos, the ant suddenly starts building a highway that goes on forever.
Try the multi-color ants, written as a string of turns like LLRR, LRRRRRLLR or RRLLLRLLLRRR, which grow symmetric shapes, squares and moving triangles. Add several ants, click on the grid to drop new ones, and watch them interact.
Customize the size of the grid, the speed and the colors, then download the result as a PNG image or record it as a video. Everything runs directly in your browser: nothing is uploaded to a server.
Langton's ant is a two-dimensional cellular automaton invented by Chris Langton in 1986. It is a Turing machine with a two-dimensional tape: an "ant" sits on a grid of white cells, facing one of the four directions, and repeats the same three moves forever:
For the first few hundred steps, the ant draws simple, often symmetric shapes. Then it enters a long chaotic phase, and after about 10000 steps it starts to repeat a cycle of 104 steps that moves it two cells diagonally, building a "highway" that goes on forever. Every starting pattern ever tried ends up building the highway, but nobody has proven that it always happens.
The rule can be extended to more colors, as proposed by Greg Turk and Jim Propp. The rule is a string with one letter for each color: when the ant is on a cell of color n, it turns according to the letter n of the rule, and the cell changes to the next color, going back to the first color after the last one. The original ant is the rule RL. Rules made of pairs of the same letter, like LLRR, always grow symmetric patterns.
| Rule | Description |
|---|---|
| RL | Langton's original ant. For about 10000 steps it builds a chaotic blob, and then it suddenly starts to build a "highway": a pattern of 104 steps that repeats forever and travels diagonally. |
| RLR | Three colors, and the ant grows a chaotic blob forever, without ever building a highway. |
| LLRR | The ant grows a symmetric shape that keeps growing forever, like a brain or a cauliflower. |
| RRLL | The mirror image of LLRR: swapping every L and R of a rule draws the mirror image of the pattern. |
| LRRRRRLLR | The ant fills the space around it with a square that keeps growing. |
| LLRRRLRLRLLR | After a long chaotic phase, the ant builds a wide and convoluted highway. |
| RRLLLRLLLRRR | The ant builds a filled triangle that grows and moves across the grid. |
Below are all the options you can configure in this Langton's ant simulator.
| Field | Description |
|---|---|
| Rule | One letter for each color: "L" turns left, "R" turns right, "N" goes straight and "U" turns back. The number of letters is the number of colors, up to 32. Changing the rule starts the simulation again. |
| Number of ants | How many ants start on the grid. You can add more by clicking on the grid, up to 64 ants. |
| Position of the ants | Where the ants start: all on the center cell, each one turned 90 degrees from the previous one; evenly spaced on a circle around the center; or at random positions and directions. |
| Direction at the start | The direction the ant faces before its first step. |
| Initial grid | An empty grid, where every cell has the first color, or a grid of random colors. |
| Seed | The number used to generate the random colors and the random positions. The same seed always gives the same start. |
| Columns, rows and size of the cell | The size of the grid in cells, and the size of each cell in pixels. The image is the number of columns multiplied by the size of the cell, by the number of rows multiplied by the size of the cell. |
| Wrap the edges of the grid | Turned on, an ant that leaves the grid comes back through the opposite border. Turned off, the ant stops when it reaches a border. |
| Steps per second | How many steps each ant takes per second. The original ant needs about 10000 steps to start its highway. |
| Maximum speed | Computes as many steps as possible on every frame, ignoring the steps per second. |
| Pause after a number of steps | Pauses the animation automatically at the step you choose, which is useful to download the image of an exact step. |
| Colors of the cells | Paints the colors of the rule with a rainbow, or with a gradient between two colors. The first color of the rule is always the background color. |
| Show the ants | Draws each ant as an arrow pointing in its direction, or as a small square when the cells are too small. The ants are also drawn in the downloaded image and in the video, so hide them if you want only the pattern. |
Yes. The tool is completely free, there is no registration, and everything is computed by your own browser: nothing is uploaded to a server.
When does Langton's ant start building the highway?Starting on an empty grid, the original ant (rule RL) starts its highway at around step 10000. Turn on "Pause after a number of steps" with 11000 steps to see the first part of the highway, or just watch it happen at 1000 steps per second.
Does the ant always build a highway?Every starting pattern ever tested ends with the highway, but it has never been proven. What has been proven is that the ant never stays inside a limited area: its path is always unbounded.
What happens when the highway reaches the border?With the edges wrapped, the highway comes back through the opposite border and eventually crashes into the old pattern, which starts a new chaotic phase, and usually a new highway later. With the edges not wrapped, the ant stops at the border.
What do the letters of the rule mean?Each letter is the turn the ant makes on a cell of that color: "R" is a right turn, "L" a left turn, "N" no turn and "U" a U-turn. The first letter is used on the background color, the second on the next color, and so on.
Can I download the animation as a video?Yes. Open the "Generate and download video" section, choose the framerate, click "Generate video", and click "Stop recording and download video" when you have enough. The video is recorded in the WebM format.
What is a turmite?A turmite is a Langton's ant with an internal state, a small memory that changes on every step, so it can do different things on the same color. Langton's ant, and every multi-color ant of this tool, is a turmite with a single state. Try the Turmite tool to see what a second state adds: spirals, triangles, diamonds and many more.
Can I use the images and the videos commercially?Yes. The images and videos you generate are yours, and you can use them in any project.





