Cellular Automata Simulator

Paint cells, run the simulation, rewind history, and compare simple rules.

Results are calculated automatically as you enter data.

Drag to paint cells. Hold Alt or toggle Erase to erase.

▼ See explanations and tips below ▼

What Is a Cellular Automaton?

A cellular automaton is a grid of simple cells that change over a series of discrete steps called generations. Each cell has a state, such as live or dead, and the next state of each cell is determined by a rule that looks only at a small local neighborhood.

The key idea is that simple local rules can produce surprisingly rich global behavior. A few live cells may disappear, settle into a stable shape, repeat in a loop, move across the grid, or produce an irregular-looking pattern. This is why cellular automata are useful for exploring emergence: large-scale patterns that arise from small-scale interactions.

Cellular automata are abstract models. They do not automatically describe a real physical system, but they give students, programmers, and researchers a clear way to experiment with discrete space, discrete time, local rules, and pattern formation.

This calculator focuses on two common families:

  • Life-like two-dimensional rules, where each square cell looks at its eight surrounding neighbors.
  • Elementary one-dimensional rules, where each cell looks at itself and its left and right neighbors to generate the next row.

Why Cellular Automata Matter

Cellular automata are valuable because they make complexity visible. Instead of starting with a long equation for the whole system, a cellular automaton starts with a small rule and lets the system evolve step by step.

That makes cellular automata useful for:

  • learning how local interactions can create global patterns;
  • comparing order, repetition, growth, decay, and apparent randomness;
  • introducing ideas from discrete mathematics, computer science, simulation, and dynamical systems;
  • experimenting with rule-based models before moving to more detailed scientific simulations.

They are also a good reminder that a rule can be easy to state but hard to predict. In many cellular automata, the most reliable way to know what happens after many generations is to run the rule and watch the evolution.


Key Terms to Know

  • Cell: One position in the grid. In this calculator, each cell is binary: active/live is \(1\), and inactive/dead is \(0\).
  • Generation: One complete update of the grid or row.
  • Neighborhood: The nearby cells used to decide a cell's next state.
  • Moore neighborhood: The eight surrounding cells in a square grid: horizontal, vertical, and diagonal neighbors.
  • Birth: A dead cell becomes live in the next generation.
  • Survival: A live cell remains live in the next generation.
  • Death: A live cell becomes dead in the next generation.
  • Density: The percentage of cells that are active.
  • Seed: The starting pattern before the simulation begins.
  • Boundary condition: How the simulation treats cells at the edge of a finite grid.
  • Elementary rule: A one-dimensional binary cellular automaton rule encoded by a whole number from \(0\) to \(255\).

How Cellular Automata Work

A cellular automaton updates all cells by applying the same rule at the same time. This simultaneous update is important. New births do not influence other births in the same generation; they only affect later generations.

Life-like birth and survival rules

In a Life-like rule, each cell has eight possible neighbors. A rule written as B3/S23 means:

  • B3: a dead cell is born when it has exactly \(3\) live neighbors;
  • S23: a live cell survives when it has exactly \(2\) or \(3\) live neighbors;
  • all other cases become or remain dead.

More generally, let \(B\) be the set of neighbor counts that cause birth, and let \(S\) be the set of neighbor counts that allow survival. Let \(x_{i,j}^t\) be the state of the cell at row \(i\), column \(j\), and generation \(t\), where \(1\) means live and \(0\) means dead. Let \(n_{i,j}^t\) be the number of live neighbors around that cell.

The next state is:

$$ x_{i,j}^{t+1}= \begin{cases} 1, & x_{i,j}^{t}=0 \text{ and } n_{i,j}^{t}\in B \\ 1, & x_{i,j}^{t}=1 \text{ and } n_{i,j}^{t}\in S \\ 0, & \text{otherwise} \end{cases} $$

This calculator accepts Life-like rules in B.../S... form, with neighbor counts from \(0\) through \(8\).

Elementary one-dimensional rules

An elementary cellular automaton has one row of binary cells. Each new row is made from the previous row by looking at three cells at a time: the left neighbor, the center cell, and the right neighbor.

There are \(2^3=8\) possible three-cell neighborhoods. A rule must choose either \(0\) or \(1\) for each of those \(8\) cases, so there are:

$$ 2^8=256 $$

possible elementary rules. That is why elementary rule numbers run from \(0\) to \(255\).

If the rule number is written in binary as:

$$ R=(b_7b_6b_5b_4b_3b_2b_1b_0)_2 $$

then the neighborhood index is:

$$ N=4s_{i-1}^{t}+2s_i^{t}+s_{i+1}^{t} $$

where \(s_i^t\) is the state of column \(i\) at generation \(t\). The next state is the rule bit at that index:

$$ s_i^{t+1}=b_N $$

For example, the neighborhood 100 has:

$$ N=4(1)+2(0)+0=4 $$

So the next state is the bit \(b_4\) of the selected rule number.

Density

Density measures how much of the current grid or row is active:

$$ \text{density}=\frac{\text{active cells}}{\text{total cells}}\times 100\% $$

In Life mode, this calculator uses a \(54\times36\) grid:

$$ 54\times36=1944 \text{ cells} $$

In elementary mode, density is based on the latest row of \(54\) cells.


Examples of Cellular Automata in Practice

Example 1: Reading B3/S23

Suppose the selected Life-like rule is B3/S23.

A dead cell with three live neighbors is born:

$$ x_{i,j}^{t}=0,\quad n_{i,j}^{t}=3 \quad \Rightarrow \quad x_{i,j}^{t+1}=1 $$

A live cell with two live neighbors survives:

$$ x_{i,j}^{t}=1,\quad n_{i,j}^{t}=2 \quad \Rightarrow \quad x_{i,j}^{t+1}=1 $$

A live cell with four live neighbors dies because \(4\) is not in the survival set \(S=\{2,3\}\):

$$ x_{i,j}^{t}=1,\quad n_{i,j}^{t}=4 \quad \Rightarrow \quad x_{i,j}^{t+1}=0 $$

This rule is the classic Conway's Game of Life rule.


Example 2: Reading an elementary rule bit

Rule \(30\) has the binary form:

$$ 30=(00011110)_2 $$

For the three-cell neighborhood 100, the index is:

$$ N=4(1)+2(0)+0=4 $$

The bit \(b_4\) in 00011110 is \(1\), so a cell with neighborhood 100 becomes live in the next row:

$$ s_i^{t+1}=1 $$

For the neighborhood 111, the index is:

$$ N=4(1)+2(1)+1=7 $$

The bit \(b_7\) is \(0\), so that neighborhood produces a dead cell in the next row.


Example 3: Edge behavior can change the pattern

Boundary conditions matter because a finite simulation has edges.

In Life mode, this calculator treats cells outside the \(54\times36\) grid as dead. A live cell in a corner has fewer possible live neighbors than a live cell in the middle of the grid, because the outside positions do not wrap around.

In elementary mode, the row wraps horizontally. The leftmost and rightmost cells are treated as neighbors. This can make an elementary pattern continue smoothly across the edge, even though Life mode does not use that same boundary behavior.


How to Interpret the Result

The result summary shows the current generation, active-cell count, and density.

Generation tells you how many steps have occurred since the current seed was initialized, randomized, cleared, loaded, painted in elementary mode, or reset by changing modes. In elementary mode, painting creates a fresh one-row seed rather than skipping ahead through uncomputed generations.

Active cells means different things in the two modes. In Life mode, it is the number of live cells in the whole \(54\times36\) grid. In elementary mode, it is the number of live cells in the latest row.

Density is the active-cell percentage. A density near \(0\%\) means few cells are active. A higher density means more cells are active, but it does not automatically mean the rule is more interesting or more complex. Some dense rules quickly become uniform, while some sparse rules produce structured movement or long-lived patterns.

Births / live next also depends on the mode. In Life mode, it counts dead cells that became live in the last step. In elementary mode, it counts live cells in the newly generated row.

Deaths / prior live has a mode-specific meaning as well. In Life mode, it counts live cells that died in the last step. In elementary mode, it reports the live-cell count in the previous row.

The population graph shows active-cell history. Its height is scaled against the largest value in the current history, so it is best read as a relative trend, not as a fixed-scale chart.

The comparison tables are projections. In Life mode, the comparison projects the selected rule and Conway's B3/S23 baseline for \(18\) steps from the current grid. In elementary mode, the comparison projects from the initial seed row for \(32\) steps and compares the selected rule with reference rules \(30\), \(90\), and \(110\). These projections do not change the current live simulation.


Common Mistakes and Misconceptions

A common mistake is entering a Life rule without the required B/S structure. Use B3/S23, not 23/3.

Another mistake is treating elementary rule numbers like arbitrary decimals. Elementary rules must be whole numbers from \(0\) through \(255\). Negative values, fractions, and nonnumeric text are not valid elementary rules.

Do not assume both modes use the same boundary condition. Life mode uses dead space outside the grid. Elementary mode wraps horizontally.

The speed setting is only a playback control. It is not the generation number, not a scientific time unit, and not an exact measure of generations per second.

The rule input that matters depends on the mode. The Life rule is used only in Life mode, and the elementary rule is used only in elementary mode.

The comparison table is not the same as pressing Step. It previews projected behavior for comparison while leaving the current simulation unchanged.

Finally, active-cell density should not be treated as a complete description of behavior. Two rules can have similar densities but very different visual structures.


When to Use Cellular Automata

Use cellular automata when you want to explore how local rules shape global behavior.

They are especially useful for:

  • classroom demonstrations of emergence and discrete systems;
  • learning the difference between local and global descriptions;
  • comparing Life-like birth/survival rules;
  • studying elementary rules and binary rule codes;
  • experimenting with seeds, gliders, oscillators, spaceships, and random starts;
  • building intuition before studying more advanced simulation models.

A cellular automaton is not the right tool when you need a validated physical, biological, financial, or engineering prediction. It is a rule-based model for exploration unless it has been carefully matched and tested against the real system being modeled.


Limitations and Things to Keep in Mind

This calculator supports binary cellular automata only. Each cell is either live or dead.

Life mode supports B.../S... Life-like rules with neighbor counts from \(0\) through \(8\). It does not support larger neighborhoods, multistate cells, imported pattern files, custom grid sizes, or toroidal Life boundaries.

Elementary mode supports whole-number Wolfram-style elementary rules from \(0\) through \(255\). It uses horizontal wrap-around boundaries and does not expose another elementary boundary option.

The grid size is fixed at \(54\) columns by \(36\) rows. In elementary mode, only up to \(36\) rows are displayed; older rows shift out after the display fills.

Random seeds use fixed probabilities: \(25\%\) live cells in Life mode and \(45\%\) live cells in elementary mode. Custom randomization probabilities are not available.

Rewind depends on stored history. The calculator cannot rewind beyond the available snapshots, and changing the mode, clearing, randomizing, painting, or loading a pattern can reset stored history.

Changing a rule affects future steps and comparison projections. It does not rewrite earlier generations that were already produced under a previous rule.

The main density is displayed to one decimal place. Counts such as generation, active cells, births, deaths, projected live cells, and peak live cells are integer counts.


How to Use This Calculator

  1. Choose Life mode for a two-dimensional B/S cellular automaton, or choose Elementary mode for a one-dimensional rule-number automaton.
  2. Enter a Life rule such as B3/S23, or enter an elementary rule number from \(0\) to \(255\).
  3. Set the starting pattern by painting cells, erasing cells, loading a Life preset, using Random, or using Clear.
  4. Adjust the speed slider to control playback speed.
  5. Use Run to start, Pause to stop, Step to advance one generation, and Rewind to restore the previous generation when history is available.
  6. Review the result summary, metric cards, population graph, comparison table, and formula explanation.
  7. Use the download controls to save the current grid or graph as a PNG image.

Frequently Asked Questions

What is the difference between Life mode and elementary mode?

Life mode is two-dimensional. Each cell uses the eight surrounding cells to decide whether it is born, survives, or dies. Elementary mode is one-dimensional, and each new row is generated from three-cell neighborhoods in the previous row.


Why does B3/S23 appear so often?

B3/S23 is Conway's Game of Life rule. It is a classic example because very simple birth and survival conditions can produce still lifes, oscillators, gliders, spaceships, and other long-lived patterns.


Why are elementary rules limited to 0 through 255?

An elementary rule has \(8\) possible three-cell neighborhoods. Each neighborhood can produce either \(0\) or \(1\), so there are \(2^8=256\) possible rules. Numbering them from \(0\) to \(255\) gives one number for every possible elementary rule.


Does a higher density mean the rule is more complex?

Not necessarily. Density only tells you how many cells are active. Complexity also depends on structure, movement, repetition, growth, decay, and sensitivity to the starting pattern.


Why does the pattern behave differently near the edge?

The edge behavior depends on the boundary condition. Life mode treats positions outside the grid as dead, while elementary mode wraps the row horizontally. Because the neighborhood is different at the boundary, the future pattern can change.


Sources and References

Books

  1. Joel L. Schiff. Cellular Automata: A Discrete View of the World. Wiley Series in Discrete Mathematics and Optimization, John Wiley & Sons, first published 2007; copyright 2008. Chapter 3, “One-Dimensional Cellular Automata,” especially the sections on cellular automata, transition functions, local rules, synchronicity, and elementary rules.
  2. Stephen Wolfram. A New Kind of Science. Wolfram Media, 2002. Chapter 3, “The World of Simple Programs,” section “More Cellular Automata”; Chapter 6, “Starting from Randomness”; Chapter 11, “The Notion of Computation.” Online edition and citation information: https://www.wolframscience.com/nks/ and https://www.wolframscience.com/nks/citation/.

Online and Official Sources

  1. Francesco Berto and Jacopo Tagliabue. “Cellular Automata.” The Stanford Encyclopedia of Philosophy, Summer 2025 edition, Metaphysics Research Lab, Stanford University. https://plato.stanford.edu/archives/sum2025/entries/cellular-automata/.
  2. Eric W. Weisstein. “Elementary Cellular Automaton.” MathWorld--A Wolfram Web Resource, accessed June 27, 2026. https://mathworld.wolfram.com/ElementaryCellularAutomaton.html.
  3. Martin Gardner. “Mathematical Games: The Fantastic Combinations of John Conway's New Solitaire Game ‘Life.’” Scientific American, vol. 223, October 1970, pp. 120-123. Stanford-hosted copy accessed June 27, 2026. https://web.stanford.edu/class/sts145/Library/life.pdf.
  4. David Eppstein. “Growth and Decay in Life-Like Cellular Automata.” In Andrew Adamatzky, ed., Game of Life Cellular Automata, Springer, 2010, pp. 71-98. DOI: 10.1007/978-1-84996-217-9_6. arXiv version accessed June 27, 2026. https://arxiv.org/abs/0911.2890.