How Do Flies Fly Into Hard Surfaces And Not Get Hurt?

Table of Contents (click to expand)

A housefly survives smacking into a window because it has almost no kinetic energy to dissipate (kinetic energy goes as m·v2/2, and a fly weighs only about 12 mg and cruises at roughly 5 mph / 8 km/h), and because the energy it does carry is absorbed by a hardened chitin exoskeleton that behaves like a tiny suit of crash-resistant armour. Small body, slow speed, tough shell.

You may have seen houseflies flying around and hitting hard, solid surfaces like doors, windows and walls for no apparent reason. Why they engage in such seemingly mindless and futile activity is beyond me, but this article is not about the head-banging tendencies of houseflies; it’s about how they actually survive those foolish maneuvers!

We know that when we run into such hard surfaces, it doesn’t end well, but how do flies seem to do exactly the same thing and get away without experiencing any problems whatsoever?

How, fly how do you do it meme

As it turns out, the answer to this question lies in the fascinating design of a housefly’s body structure.

A Housefly’s Exoskeleton

Unlike vertebrates (whose skeletons are located inside their bodies), a housefly’s skeleton, like all insects, is located outside its body. Therefore, it is quite aptly called an exoskeleton. An exoskeleton is an amazing structure that not only provides shape and support to the housefly, but also minimizes the loss of bodily fluids in both chemical and physical attacks, and shields it from physical injuries (to a certain extent).

The exoskeleton of a fly is divided into three parts: head, thorax and abdomen.

Housefly anatomy key diagram
Major sections of a fly’s body structure.(Photo Credit : Al2 / Wikimedia Commons)

Now, the thing about a housefly’s exoskeleton that is relevant to this article is that it’s both super hard and flexible at the same time. Sounds confusing, doesn’t it? Allow me to explain…

You see, the exoskeleton of a fly is made from a polysaccharide called chitin, which binds with certain molecules to form a “body wall” of sorts that is both as rigid and hard as some metals, while also being as flexible as rubber (in some spots) at the same time. It is this characteristic of a housefly’s exoskeleton that helps it brave the ordeal of ramming into hard surfaces without feeling a thing.

How Do Flies Fly Into Hard Surfaces And Not Get Hurt?

Because their “body wall” is strong and flexible (at certain points), it allows houseflies to hit and bounce off walls, and doors, rather than being squishing like a worm.

Houseflies Are Small!

Most species of houseflies are actually very small (0.1 – 1.0 inch in length). This is a fantastic thing for anything with an exoskeleton. The exoskeleton of a larger organism (say, a cow) would have to be proportionally thick in order to support the weight of the organism. A thicker exoskeleton would also be significantly heavier and more cumbersome to carry around. Since flies are tiny, they don’t have any problem toting around a hard exoskeleton.

Furthermore, according to the square-cube law, as something grows larger, its volume and weight grow faster than its surface area. (Fun fact: the square-cube law is the reason that elephants need legs the size of tree trunks, and kids can sit comfortably on their knees, but adults usually don’t). Since houseflies are small and light, less weight is dispersed over a larger surface area when they run into a wall, thus allowing them to escape unscathed.

Most species of houseflies are tiny (Photo Credit : Pixabay)
Most species of houseflies are tiny (Photo Credit : Pixabay)

Houseflies Aren’t That Fast

While attempting to catch a fly at some point in life, you might have been amazed (and annoyed) at their great maneuverability skills. Some of you might have even marveled at how fast they buzz by your ears. If you have, then I have some bad news for you:
Houseflies are slowoooooooooow meme

Most flies have an average speed of 5 mph (8 kmph), which is actually very slow. However, flies are still among the speediest of insects! Therefore, the fact that they don’t seem to sustain injuries when they hit hard surfaces is quite intuitive.

In a nutshell, the combination of their small size, low speed and hard exoskeleton is what allows a housefly to brave the dangers of ramming into a wall, and accounts for its impressive reputation among other insects.

Why Do Flies Keep Flying Into Windows?

So we know how a fly walks away from a collision unharmed, but there’s a second mystery hiding inside the first: why do flies keep blundering into windows and walls in the first place? For years, the stock answer was that flies are simply “attracted to light” and treat a bright window as an open door. It turns out that tidy explanation is mostly wrong.

A housefly resting on a window railing, where indoor flies often gather
(Photo Credit: IM3847 / Wikimedia Commons, CC BY-SA 4.0)

A 2024 study in Nature Communications tracked flying insects around lights with high-speed motion capture and found that they don’t actually steer toward a glowing window at all. Instead, insects rely on something called the dorsal light response: they keep their back (their dorsum) pointed at the brightest part of the sky, which is a brilliantly simple way to stay upright and level in the open. Under a real sky, “brightest thing above me” reliably means “up”, so it works.

The problem is that a window, a lamp or a ceiling light is a fake sky. When a fly tries to keep its back aimed at that artificial bright patch, it ends up banking, looping and circling around the light instead of flying past it, sometimes climbing, stalling or even flipping over. To us it looks like the fly is hurling itself at the glass on purpose. In reality, its auto-pilot is just locked onto the wrong “sky”, and the pane keeps getting in the way. For more on this misread instinct, see our piece on why insects are drawn to artificial lights. And thanks to that tough little exoskeleton, each accidental tap against the glass costs the fly almost nothing.

Do Flies Actually Feel Pain When They Hit Something?

“Not getting hurt” has two meanings: not getting injured, and not feeling any pain. The exoskeleton handles the injury part, but the pain question is far more interesting, and the science has shifted a lot in recent years.

Close-up of a housefly's compound eye and head
(Photo Credit: Fedaro / Wikimedia Commons, CC BY-SA 4.0)

For decades, the textbook view was that insects have nociception (the raw ability to detect damaging stimuli like heat or a sharp edge) but probably don’t feel anything the way we do. A major 2022 review in Advances in Insect Physiology reopened that case. Weighing more than 350 studies against eight criteria for pain, the authors reported that adult flies (the order Diptera) and cockroaches show the strongest evidence of any insects, meeting six of the eight criteria at a high or very high level of confidence. Fruit flies, the lab cousins of houseflies, even have nerve pathways that carry damage signals up to integrating regions of the brain, not just simple reflex loops.

So a fly tapping a window almost certainly isn’t a painful event, because there’s barely any force involved. But the bigger picture is that we can no longer wave flies off as tiny unfeeling robots. What about being “knocked out”? A hard swat can stun or kill a fly outright, yet a glancing blow may just leave it dazed for a moment before it rights itself, which is less a knockout in the boxing sense and more a temporary scramble of a very small nervous system. The honest summary: a healthy fly bouncing off glass walks away unbothered, but “feels nothing at all” is no longer a safe assumption.

References (click to expand)
  1. Reasons for Success - projects.ncsu.edu
  2. Insect Body Parts - www.uky.edu
  3. House Fly | Livestock Veterinary Entomology. Texas A&M University
  4. Darkfield Gallery - House Fly (Musca domestica). Florida State University
  5. Homeotic Genes and Body Patterns - Learn Genetics Utah. The University of Utah
  6. house fly - Musca domestica Linnaeus. The University of Florida
  7. New Blog Explores Science Fiction | Vanderbilt University. Vanderbilt University
  8. Froese, R. (2006, August). Cube law, condition factor and weight-length relationships: history, meta-analysis and recommendations. Journal of Applied Ichthyology. Hindawi Limited.
  9. Fabian, S. T., et al. (2024). Why flying insects gather at artificial light. Nature Communications. NIH/PMC.
  10. Gibbons, M., et al. (2022). Can insects feel pain? A review of the neural and behavioural evidence. Advances in Insect Physiology. Queen Mary University of London.