
This is a free online Barnsley fern generator. Choose how many points are placed, pick the colors of the gradient, and download the result as a PNG image.
The Barnsley fern is the most convincing argument that nature's shapes can come from very little information. The whole plant — stem, leaflets, the curl at the tip, the way each leaflet repeats the shape of the whole frond — is produced by four simple formulas and a random number generator. There is no drawing, no model of a plant, and no image: only twenty four numbers.
Each point is placed by picking one of the four formulas at random and applying it to the previous point. The points land in an unpredictable order, and yet the fern always appears.
Everything runs directly in your browser. No image is uploaded to a server, and nothing needs to be installed.
Use the mouse wheel over the image to zoom in and out, and drag the image to move it. On a phone, use one finger to move the image and two fingers to zoom. The checkered squares show the transparent areas of the image: they are not part of the downloaded PNG file.
| Field | Description |
|---|---|
| Variant | The set of four transforms that is used: the classic Barnsley fern, or the Cyclosorus fern, which produces a different species. |
| Number of points | How many points the chaos game places. This controls the density of the plant: too few and the fern looks like a spray of dust, many and it becomes a solid leaf. |
| Size of the points | The size of each dot in pixels. Keep it at 1 for the finest detail, and raise it when you want a bolder plant without waiting for millions of points. |
| Zoom, Rotation, Margin | How the fern is framed inside the image. The margin is the empty space left around the drawing, in pixels. |
| Coloring | One flat color, or a gradient between two colors that follows the height of the plant, from the base of the stem to the tip of the fern. |
| Transparent background | Leaves the background of the PNG transparent, so the fern can be placed over any color or image. |
| Resolution / Width / Height | The size of the generated image, in pixels. |
The fern is an iterated function system. Start at the point (0, 0). Then, millions of times, pick one of four transformations at random and apply it to the current point, drawing a dot wherever you land. Each transformation is an affine map: it can stretch, squash, rotate, flip and move a point, but it always turns straight lines into straight lines.
What makes the fern readable is that each of the four transforms has a clear job, and is chosen with a very different probability:
| Transform | Chosen | What it draws |
|---|---|---|
| The first one | 1% of the time | Flattens everything onto a vertical line: this is the stem. |
| The second one | 85% of the time | Shrinks the plant slightly, rotates it a little and moves it up: this is what stacks a smaller copy of the whole fern above the previous one, creating the main frond. |
| The third one | 7% of the time | Makes a small, strongly rotated copy: the leaflets on the left. |
| The fourth one | 7% of the time | The mirror image of the third one: the leaflets on the right. |
The probabilities are not decoration: they are chosen to match how much area each transform is responsible for, so that every part of the fern receives points at the same rate. That is why the stem, which is a thin line, needs only 1% of the points, while the main frond needs 85%.
The fern was published by the British mathematician Michael Barnsley in his 1988 book Fractals Everywhere. His larger point was practical: if four formulas can encode a fern, then images in general might be stored as the transforms that generate them rather than as pixels. That idea became fractal image compression.
Yes, this tool is 100% free and works directly in your browser, with no installation and no sign-up required.
Are the images uploaded to a server?No. The fern is calculated by your own browser and the image never leaves your computer.
Can I use the generated images in my own projects?Yes. The images come from a mathematical formula, and you are free to use them in websites, wallpapers, posters, videos, games and printed material.
Why does the fern look grainy or full of holes?There are not enough points yet. Raise "Number of points" — half a million is a good value for a detailed fern — or raise the "Size of the points" to 2 pixels, which fills the gaps much faster.
Why does the image appear little by little?Because the points are placed in batches, so that the page keeps responding while millions of them are being calculated. The progress bar under the image shows how far it is.
Does the fern look different every time?The individual dots land in a different order every time, because the transforms are chosen at random. The shape, however, is always exactly the same: the randomness only decides the order in which the picture fills in, not what is drawn.
Is the fern really made of only four formulas?Yes. Each of the four transforms is defined by six numbers plus a probability, so the entire plant is described by fewer than thirty numbers. That is far less information than a photograph of a fern.
Why do I keep seeing the same shape inside the leaflets when I zoom in?Because the fern is self similar: the second transform places a smaller copy of the whole plant a little higher up, so every leaflet is, in miniature, a copy of the entire fern. Remember to raise the number of points when you zoom, or the detail will look sparse.
What is the chaos game?It is the method used here: jump to a random transform, apply it, draw a dot, repeat. The same method draws the Sierpinski triangle with three transforms instead of four.
Where can I see other fractals?Try the Sierpinski Triangle Generator, the Koch Snowflake Generator, the Dragon Curve Generator and the Mandelbrot Set Generator.





