Box-Counting Dimension Lab illustration

Box-Counting Dimension Lab

How do you measure the dimension of a coastline? Cover the shape with boxes of size ε, count the boxes N(ε) it touches, shrink ε and repeat: the slope of log N against log 1/ε is the box-counting dimension. This lab does the whole procedure live on a Koch curve, a Sierpinski triangle or a random coastline — overlaying the grid, counting occupied boxes at each scale, plotting the log–log points and fitting the line — so you can watch a non-integer dimension emerge from plain counting.

Runs 100% in your browser — simulations are computed locally on your device.

Notes

  • The Koch curve’s true dimension is log 4/log 3 ≈ 1.262; the Sierpinski triangle’s is log 3/log 2 ≈ 1.585.
  • A smooth curve gives slope 1 and a filled region slope 2 — fractals land strictly in between.
  • Box counting is how the fractal dimension of real coastlines and clouds is estimated in practice.
  • Runs 100% in your browser — simulations are computed locally on your device.