Fractal Dimension Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

What this fractal dimension calculator does

This calculator computes the self-similar (Hausdorff) fractal dimension of an ideal fractal using the classic scaling relationship between the number of self-similar pieces and their linear scaling ratio. You enter:

The tool then returns the fractal dimension D, which may be non-integer (for example, 1.26). This helps quantify how “space-filling” or detailed a self-similar structure is as you zoom in.

Fractal dimension in a nutshell

Classical geometry assigns integer dimensions to simple shapes: a line is 1-dimensional, a plane is 2-dimensional, and ordinary 3D space is 3-dimensional. Fractals often do not fit neatly into this scheme. They can be more complex than a line but less than a filled plane, giving them a fractional or fractal dimension such as 1.26 or 1.58.

Intuitively, the fractal dimension measures how the amount of detail, or the number of pieces needed to cover a set, changes as you refine your scale of observation. For many self-similar fractals, this scaling is regular enough that a simple formula relates dimension, number of pieces, and linear scale factor.

The self-similarity formula

For an ideal self-similar fractal that can be decomposed into N smaller copies of itself, each scaled down by a linear factor r (with 0 < r < 1), the self-similar (and, under suitable conditions, Hausdorff) dimension D is defined by the relationship:

N = 1 r D

This says that the number of self-similar copies equals the scale factor raised to the power of the dimension. Solving this equation for D gives:

D = log(N) / log(1 / r)

Here, log can be any logarithm base (natural log, base 10, etc.) as long as the same base is used in both numerator and denominator. The calculator uses natural logarithms internally, but the result is independent of the base.

How to use the calculator

  1. Choose N (number of pieces).
    • Count how many smaller self-similar copies compose the figure at one iteration.
    • Example: for a square split into four equal smaller squares, N = 4.
    • Example: for a line segment replaced by three equal segments in a row, N = 3.
  2. Choose r (scaling ratio).
    • r is the linear size of each copy divided by the linear size of the original.
    • It must satisfy 0 < r < 1; smaller r means more aggressive shrinking.
    • Example: halving the length of a segment means r = 1/2 = 0.5.
    • Example: replacing each side with segments one third as long gives r = 1/3 ≈ 0.3333.
  3. Compute the dimension.
    • Enter your values of N and r into the form.
    • Submit the form to evaluate D = log(N) / log(1 / r).
    • The result is typically shown to several decimal places to capture non-integer values.

A higher value of D indicates that the set becomes more space-filling as you zoom in. For example, a plane-filling set has dimension 2, while many classic fractal curves have a dimension strictly between 1 and 2.

Worked examples

1. Straight line segment

Consider a line segment broken into three equal smaller segments arranged end to end. Each segment is a scaled copy of the original.

Plugging into the formula:

D = log(3) / log(1 / (1/3)) = log(3) / log(3) = 1

This matches the familiar idea that a line is 1-dimensional.

2. Filled square

Take a square, and divide it into a 2 × 2 grid of equally sized smaller squares, all of which are kept.

Then:

D = log(4) / log(1 / (1/2)) = log(4) / log(2) = 2

So the figure fills a 2-dimensional region, as expected.

3. Koch snowflake / Koch curve

The Koch curve is constructed by repeatedly replacing each line segment with four segments, each one third as long, forming a characteristic spike.

Thus:

D = log(4) / log(1 / (1/3)) = log(4) / log(3) ≈ 1.2619

This value lies between 1 (a regular line) and 2 (a filled area), reflecting that the curve is rougher than a line but does not fully fill the plane.

Comparison of example structures

The table below compares several common self-similar sets and how their parameters affect the computed dimension.

Structure N (number of pieces) r (scaling ratio) Computed fractal dimension D
Straight line segment 3 1/3 1
Filled square 4 1/2 2
Koch curve 4 1/3 ≈ 1.2619
Sierpiński triangle 3 1/2 ≈ 1.5849
Sierpiński carpet 8 1/3 ≈ 1.8928

This illustrates how changing N and r influences the dimension:

Interpreting your result

After computing the fractal dimension with this tool, you can interpret the value in broad terms:

In many scientific and engineering applications, fractal dimension serves as a compact measure of complexity, irregularity, or roughness. For instance, a higher dimension for a coastline model indicates a more jagged shape; in dynamical systems, strange attractors often have non-integer dimensions that reflect their intricate structure in phase space.

Assumptions and limitations

This calculator is designed for a specific, idealized class of fractals. Keep the following assumptions and limitations in mind when interpreting any result:

Further exploration

To deepen your understanding of fractal dimension beyond this simple self-similarity framework, you may want to explore topics such as box-counting dimension, correlation dimension, and multifractals. These approaches extend the idea of dimension to more irregular or statistically self-similar sets, including many real-world data sets and complex dynamical systems.

Enter N and r.

Embed this calculator

Copy and paste the HTML below to add the Fractal Dimension Calculator (Self-Similarity Method) to your website.