They reach up with their front legs, grab on and use their momentum to swing their bodies up.
For many years people thought flies landed upside down by performing a last-minute barrel roll and grabbing on.
But in 1945 high-speed photography revealed the truth – that they fly close to the ceiling, reach up with their front legs and grab on.
“They then switch off and fold their wings away, and swing their body under them in order to lock onto the ceiling,” according to the Naked Scientists.
Grabbing on involves latching “miniature grappling hooks” on to something rough or spiky – and to return to flight they “just let themselves go”, the website adds.
Now watch this funny video about how flies land upside down.