Skip to the page
Explorable Illusions

See for yourself — then run it 100,000 times.

Murmuration: Starlings Track a Count, Not a Distance

Explorable Illusions · Published

A starling in a murmuration reacts to about six or seven nearest neighbors, on average. That is the count Ballerini and colleagues reported in PNAS in 2008, from 3D positions of starlings in 10 flocks over Rome. The count stayed about the same in dense flocks and sparse ones, so it is a number of birds, not a distance. In their own computer flocks, a rule like that kept the flock together better after a simulated attack.

Protocol · 5 parts
A huge flock of starlings at dusk over reeds and water, with a denser knot on the right and a looser band above.
Starlings over reeds and water at dusk. The main flock spreads across the sky, a denser knot of birds sits to its right, and a looser band trails above."Dance Of The Starlings" by Conni Nielsen — https://commons.wikimedia.org/wiki/File:Dance_Of_The_Starlings_(201781509).jpeg — CC BY 3.0 (https://creativecommons.org/licenses/by/3.0/)

At a glance

Name
Murmuration (a large flock of starlings turning together)
Also called
Starling murmuration; in models, flocking; simulated birds are called boids
First recorded
Not traced on this page. The six-to-seven neighbor count was reported by Ballerini and colleagues in PNAS in 2008; the boids model was published by Craig Reynolds in 1987
Type
Collective motion of European starlings (Sturnus vulgaris), and the flocking models built to imitate it
Main explanations
Field result: each starling interacts on average with about six or seven nearest neighbors, a count rather than a distance (strong: 3D positions in 10 flocks). Why six or seven is open: one proposal is a limit on how many objects a bird can track, a second is a range that suits escape from predators (both offered as hypotheses)
On this page
A boids player with three rule sliders and a switch between a neighbor radius and a neighbor count, still figures, and a CSV of the run shown on the page

starling-murmuration-glance.csv (CSV) · what the file holds and its license

A murmuration is a large flock of starlings wheeling together, often over the place where they will spend the night. Ballerini and colleagues describe starlings gathering in the evening over the roost in flocks of a few hundred to tens of thousands of birds. This page looks at one bird inside such a flock and asks what it pays attention to. A player further down runs the three flocking rules Craig Reynolds published in 1987.

Six or seven neighbors, near or far

The Rome team photographed 10 flocking events at Termini railway station between December 2005 and February 2006. Cameras set 25 m apart took stereo pairs at 10 frames per second, and from these pairs the team rebuilt the 3D positions of most of the birds in flocks of up to 2,600 European starlings.

Then they looked at where each bird’s neighbors sit. A starling’s nearest neighbor rarely sits along the line of flight, and that lopsided pattern is a trace of how birds react to each other.

The pattern fades for the second, third and further neighbors. In the two flocks plotted in the paper, it is all but gone between the sixth and the seventh. Averaged over all the flocks, the range came to 6.5 birds, with a standard error of 0.9.

One bird in a dense and a sparse flock: the same circle holds 20 other birds, then 2; seven nearest marked in both.

Open the diagram full size

One bird (black) in a dense and a sparse flock drawn for this page. The dashed circle is the same size in both and holds 20 other birds, then 2. The seven nearest (purple) are seven either way."Seven nearest against a fixed circle, dense and sparse" by Explorable Illusions — https://explorableillusions.com/simulations/starling-murmuration/ — CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

Packing varied a lot from flock to flock. The average distance to the nearest neighbor ran from 0.68 m in the densest flock to 1.51 m in the sparsest. The range in meters grew with that spacing. The range counted in birds showed no clear link to it.

Within one fixed distance, the authors note, the densest flock held 10 birds and the sparsest only 1. A rule based on distance would have given each bird a very different number of neighbors in different flocks. The data matched a fixed count.

Why would a count hold a flock together?

Ballerini and colleagues argue that a count is the safer rule when a flock stretches. Under a distance rule, a bird that drifts further out than its range loses touch with the rest of the flock, and stragglers drop out. Under a count rule, the pull between neighbors stays the same at any density, so a flock can thin out, change shape or even split, yet stay just as cohesive.

The same 100 scattered birds linked two ways: by a fixed radius, 2 birds have no neighbor; by 7 nearest, every bird picks 7.

Open the diagram full size

One loose scatter of 100 birds, the starting state of the player below, linked two ways. With a radius of 25 units, birds have 0 to 7 neighbors and 2 have none. Linking each bird to its 7 nearest gives every bird 7 picks, but a line marks either bird’s pick, so many birds touch more than 7 lines."One scatter of 100 birds linked by radius and by count" by Explorable Illusions — https://explorableillusions.com/simulations/starling-murmuration/ — CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The figure shows the difference before anything moves. That part follows from the definitions alone: a radius can leave a bird with nobody, and a count never does.

The Rome team tested the idea with a simple 2D flocking model in which each bird turns toward the average heading of its neighbors. A simulated predator then swept past the flock. With a distance rule, the flock most often broke into 5 pieces, and lone stragglers made up 43% of the pieces. With a count rule, the most likely outcome was a single flock, and stragglers made up 5% of the pieces.

This page does not rerun that experiment, because the paper does not give every setting needed to rebuild it.

Reynolds’s three rules for boids

Craig Reynolds built a computer model of flocking in 1986 and called the simulated birds boids. His 1987 paper at the SIGGRAPH conference set out three behaviors, in order of priority: avoid collisions with nearby flockmates, match their velocity, and stay close to them. On his boids page the same three go by shorter names: separation, alignment and cohesion.

Three panels: a bird steers away from close neighbors, turns to their heading, and heads for their center.

Open the diagram full size

The three rules for one bird (purple). Separation pushes it away from birds that are too close, alignment turns it toward its neighbors’ average heading, and cohesion pulls it toward their center (x)."Separation, alignment and cohesion for one bird" by Explorable Illusions — https://explorableillusions.com/simulations/starling-murmuration/ — CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

In Reynolds’s model, a boid’s nearby flockmates were those in a zone set by distance, and on his boids page also by an angle from the direction of flight. He noticed the catch himself in 1987. If the pull toward the flock were purely local, he wrote, two flocks far enough apart would simply ignore each other. Ballerini and colleagues point out that most flocking models still measured neighbors by distance when they wrote in 2008.

Run the boids yourself

The player below runs a simplified 2D version of Reynolds’s three rules. As in his model, a bird’s neighbors are the birds within a set distance, here 25 units.

A loose flock of 100 birds, ready to run

This page’s run: birds within 25 units, the weights in the CSV, seed 20261112.

Bird positions at step 0 and step 800: birds within 25 unitsGreen dots: the 100 birds at step 0. Purple triangles: the same birds at step 800, each pointing the way it flies. Birds within 25 units, the CSV's weights. Polarization 0.829 at step 0, 0.980 at step 800; 10 groups at step 0, 8 at step 800.Step 0Step 800Neighbors:within 25 unitsWorld 800 × 800,edges wrapSeed 20261112

Polarization and groups at the checked steps

StepPolarizationGroups
00.82910
500.96513
1000.98011
2000.9849
4000.9838
8000.9808

murmuration-start.csv (starting positions, velocities and settings of all 100 birds, CSV)

"A loose flock of 100 birds, ready to run" by Explorable Illusions — https://explorableillusions.com/simulations/starling-murmuration/ — CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The player starts paused. The world is 800 by 800 units and wraps around at the edges.

At step 0, 100 birds are scattered over a 240 by 240 square, heading within 60 degrees of the same direction at 1.5 units per step. Speeds stay between 1 and 2 units per step. Birds closer than 25 units are linked, and linked birds count as one group. A polarization of 1 would mean every bird heading the same way, and 0 would mean the headings cancel out.

  1. Press Play and watch the polarization counter.
  2. Go back to the start and press Step a few times to see single moves.
  3. Drag the sliders to change the separation, alignment and cohesion weights.

Polarization starts at 0.83 and reads 0.98 by step 100 in this page’s run. That climb is the gasp point of this page: no bird can see more than 25 units, and none is told where the flock is going, yet nearly all of them end up heading the same way. The player moves no faster than 30 steps a second.

What the run shows, next to Reynolds’s description

Reynolds described what his boids did once released near one another. They flocked together, kept a prudent distance from their neighbors, and quickly became polarized, all heading about the same way. Solitary boids and smaller flocks joined into larger ones.

Two line charts over 800 steps: polarization rises from 0.83 to 0.98; groups go from 10 to 8.

Open the diagram full size

This page’s run, recorded every 10 steps. Polarization (top) passes 0.96 by step 50 and stays near 0.98. Groups (bottom) climb to 13 by step 40, then merge down to 8 by step 210."Polarization and groups over 800 steps of a boids run" by Explorable Illusions — https://explorableillusions.com/simulations/starling-murmuration/ — CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The run is consistent with both points. Polarization reaches 0.965 by step 50. At first some linked birds drift more than 25 units apart, so the group count rises from 10 to 13, and then groups that meet merge, down to 8 by step 210.

The merging stops there. From step 210 to step 800 the count stays at 8: at every recorded step, the 8 groups, flying almost the same way, were more than 25 units apart. That is Reynolds’s own catch from 1987 in action: two flocks far enough apart ignore each other.

Reynolds also noted on his boids page that the heading of his flock a few minutes ahead was all but impossible to predict, even though each boid follows simple rules. A double pendulum is hard to forecast far ahead too, for a different reason: a tiny change at the start grows until two swings part ways. The page’s numbers can be repeated only because the start, the rules and the order of every sum are fixed.

Each bird here reacts only to what surrounds it, a little like the Ebbinghaus illusion, where the same circle can look larger or smaller depending on the circles around it. Traffic runs on local choices too: in the Braess paradox, a new road can make every trip slower when each driver picks the quickest route.

Questions about murmurations

Why six or seven neighbors and not more?

Ballerini and colleagues offer two possible reasons and do not choose between them. One is a limit on tracking: a bird may only be able to keep track of a handful of objects at once, and they note that trained pigeons can tell apart sets of fewer than seven objects. The other is that a range of about this size may suit escape from predators, balancing too little information against too much noise.

Why do starlings gather in such big flocks?

Holding the flock together matters to the birds, Ballerini and colleagues stress, citing earlier work that stragglers and small groups are more likely to fall to predators. Their paper describes starlings gathering over the roost in the evening, and the flocks they filmed reached 2,600 birds. This page has not read further work on why starlings roost together.

What is a boid?

A boid is a simulated flocking bird. Craig Reynolds coined the name for the creatures in his 1986 flocking model, and his 1987 paper describes how each one steers by itself.

Check it yourself

Every model number on this page comes from one program, with 100 birds, the settings in the player’s CSV and starting seed 20261112.

ClaimSettingsResult
A radius can leave a bird with no neighborthe 100 starting birds, radius 250 to 7 neighbors per bird, 3.38 on average; 2 birds with none
A count gives every bird the same numberthe same birds, 7 nearest7 neighbors per bird
The boids line upradius 25, usual weightspolarization 0.83 at step 0, 0.965 at step 50, 0.980 at step 100
Small groups merge, then stopradius 25, usual weights10 groups at step 0, 13 at step 40, 8 from step 210 to step 800
Without alignment the flock comes apartradius 25, alignment 014 groups, 4 of them lone birds, at step 800

Polarization and groups every 10 steps (CSV) · what the file holds and its license

The player’s CSV holds the starting position and velocity of all 100 birds and the full settings. Any program that follows the steps described with it can rerun this flock.

Now break it

Turn alignment off. Separation and cohesion still work, but no bird turns to match its neighbors.

Bird tracks over steps 700 to 800, usual settings: purple tracks run side by side in 8 bunches.

Open the diagram full size

Before: the usual settings. Tracks over steps 700 to 800 run side by side in 8 bunches."Bird tracks, steps 700 to 800, usual settings" by Explorable Illusions — https://explorableillusions.com/simulations/starling-murmuration/ — CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
Tracks over steps 700 to 800, alignment off: 14 groups, 4 of them single birds.

Open the diagram full size

After: alignment set to 0, the same start and radius. At step 800 the birds are in 14 separate groups, 4 of them single birds."Bird tracks, steps 700 to 800, alignment off" by Explorable Illusions — https://explorableillusions.com/simulations/starling-murmuration/ — CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

In the player, drag the alignment slider to 0 to see it happen. Then try the switch next to the sliders, which gives each bird its 7 nearest neighbors instead of all birds within 25 units, the kind of rule Ballerini and colleagues measured in starlings. This page reports no numbers for that switch, because this simplified player is not the model they tested.

Try this next: Conway’s Game of Life — another grid of simple local rules, where five cells walk across the board and a 36-cell machine keeps sending them out.

Sources

  1. M. Ballerini, N. Cabibbo, R. Candelier, A. Cavagna, E. Cisbani, I. Giardina, V. Lecomte, A. Orlandi, G. Parisi, A. Procaccini, M. Viale and V. Zdravkovic, “Interaction ruling animal collective behavior depends on topological rather than metric distance: Evidence from a field study,” Proceedings of the National Academy of Sciences 105, no. 4 (2008): 1232–1237. https://pmc.ncbi.nlm.nih.gov/articles/PMC2234121/Read: full text of the PNAS version (Results, Discussion, Materials and Methods, figure legends 1 to 4); the arXiv preprint abstract compared
  2. Craig W. Reynolds, “Flocks, Herds, and Schools: A Distributed Behavioral Model,” Computer Graphics 21, no. 4 (SIGGRAPH ’87 Conference Proceedings, July 1987): 25–34. https://www.red3d.com/cwr/papers/1987/boids.htmlRead: sections on simulated flocks, the neighborhood and flock behavior, in the author’s online reprint (no figures)
  3. Craig Reynolds, “Boids: Background and Update,” red3d.com. https://www.red3d.com/cwr/boids/Read: full page

Cite this page

Explorable Illusions. (2026). Murmuration: Starlings Track a Count, Not a Distance. Explorable Illusions. Published 2026-11-13. https://explorableillusions.com/simulations/starling-murmuration/

Add the date you read it. Figures and CSV files on this page are CC BY 4.0 unless their credit line says otherwise.

How pages here are checked Corrections log Report an error: contact@explorableillusions.com

More in Explorable Simulations

  • Grid with the Gosper glider gun in purple across the top and three five-cell gliders in green trailing down to the right.
    Explorable Simulations

    Conway’s Game of Life: A Glider Gun Fires Every 30 Steps

    Conway’s Game of Life in four rules: step a five-cell glider across the grid, then watch the Gosper glider gun add one glider every 30 generations.

    Picture credit

    "Gosper glider gun at generation 90" by Explorable Illusions — https://explorableillusions.com/simulations/game-of-life/ — CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

  • Illustration: a two-part pendulum hanging at rest from a fixed pivot on a wooden frame.
    Explorable Simulations

    Double Pendulum: In a Model, 120° Runs 0.001° Apart Diverge

    In this page’s double pendulum model, two swings released 0.001° apart from 120° are over 10° apart after 9.4 s. From 5°, they stay in step for a full minute.

    Picture credit (illustration)

    Illustration: Explorable Illusions. Generated schematic image — not a photograph, historical record, or test stimulus. Reuse: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/), to the extent any rights exist.

  • Illustration: night traffic, every car's lights crowding into one narrow middle road.
    Explorable Simulations

    Braess Paradox: A New Road Can Make Every Trip Longer

    Open a zero-minute shortcut and each of 4,000 drivers in this model network arrives 15 minutes later. See why no one goes back, and Braess's own 83 and 92.

    Picture credit (illustration)

    Illustration: Explorable Illusions. Generated schematic image — not a photograph, historical record, or test stimulus. Reuse: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/), to the extent any rights exist.