Falling Sand Simulator screenshot

Falling Sand Simulator

Paint sand, water and stone onto a canvas and watch the grains fall, pile up and spread. Seeded, deterministic, and running entirely in your browser.

Privacy First
0 Runs
Updated 2026-11-07
Runs in your browser
Simulation only, no real material
Nothing sent to a server
Works offline after load

How this simulation works

Falling sand is a cellular rule with three materials: sand falls into an empty cell below it and slides diagonally when blocked, water falls and then spreads sideways into empty cells, and stone never moves. Cells are scanned from the bottom up so a grain cannot fall twice in a single step, and every sideways choice is taken from the seed so a run is reproducible. You paint the materials yourself with the brush, which makes the page a small physics toy rather than a generator.

How to use it

Choose sand, water or stone in the brush selector, then click or drag on the canvas to place it. Press Play to let gravity run, Pause to freeze the pile, and Clear to empty the field.

Why it runs in your browser

The simulation runs on this page with JavaScript and the canvas API. Nothing is uploaded, no account is needed, and the page works offline after it loads.

This is a browser simulation of a box of falling grains. You paint sand, water or stone onto an eighty by forty-eight grid and watch the rules move it, one generation at a time or on a timer.

The rules are simple and stated on the page: a grain falls when the cell below is empty, slides to a diagonal when it cannot fall, water spreads sideways when it cannot fall, and stone never moves. Nothing here predicts a real material.

The seed decides how the box starts before you paint. The same seed fills the same cells, so a run is reproducible, and the clock only affects how fast you watch it.

The rule that runs each step

The grid is scanned from the bottom row upward, so a grain that falls has already passed the row it lands in and cannot fall twice in one step. That scan order is what keeps the motion stable.

A slide chooses its side from a seeded bit and then tries the other side, so the diagonal is a single cell and reproducible rather than wall-jitter. Each moved cell is locked for the rest of the step.

Water occupies two cells horizontally when it can, which is why a column of water settles into a flat surface while sand forms a cone.

  • Grid: 80 columns by 48 rows
  • Materials: sand, water, stone
  • Brushes paint on click or drag

What the box is not modelling

There is no pressure, viscosity, angle of repose or conservation of momentum beyond the cell rules. Water in this box spreads but does not find a level through a narrow gap the way a fluid would.

The box has walls and a floor and does not wrap, so grains settle rather than reappearing at the top. Clear empties it; Reset returns to the seeded starting fill.

How to use the brush and seed

Set the Seed, pick the sand, water or stone Brush, and paint onto the eighty by forty-eight grid. The seed decides the starting grains, so the same seed starts the same box.

Press Play to run generations on a timer or Step for one at a time; Reset returns to the seed and Clear empties the box. Grains fall, slide and spread by the rules stated on the page; stone never moves.

What to Expect

Best for

  • Watching a cellular-automaton material rule settle into piles
  • Demonstrating why scan order matters in a grid simulation
  • A small canvas toy that runs entirely in the tab

Not ideal for

  • Predicting how a real granular material will behave
  • A physics engine with forces, friction and pressure
  • A long animation, which is a browser toy rather than a renderer

What this tool keeps

  • The seeded starting fill for a given seed
  • Painted cells until Clear or Reset
  • A paused start when reduced motion is requested

What may need cleanup

  • Any physical inference from the result
  • Painted strokes, which Reset discards
  • A very full box, which settles slowly at the chosen frame rate

Common errors

  • Expecting water to equalise through a one-cell gap
  • Reading the settling order as a physical measurement
  • Painting while paused and assuming nothing happened

Example use cases

  • A teaching example of a bottom-up grid scan
  • A five-minute demonstration of emergent piles
  • A canvas test fixture with a reproducible seed

Sample input

Seed 4821, the sand brush, and a drag across the middle of the box.

Sample output

A seeded fill of grains plus the painted stroke, settling into cones where the sand piles against stone.

Who this is for

  • Teachers demonstrating cellular automata
  • Developers wanting a small canvas simulation
  • Anyone curious how simple rules make piles

Frequently asked questions

What can I paint in the falling sand box?

Sand, water or stone on an eighty by forty-eight grid, moved one generation at a time or on a timer.

Does it model real granular physics?

No. It applies a small rule set per step, with no forces, friction or pressure.

Why does a full box settle slowly?

A very full box settles at the chosen frame rate, so the last grains take longer to come to rest.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.