To find out the chemical signal that triggers this metamorphosis, scientists from Oxford University, Cambridge University and Sydney University began monitoring locusts in the laboratory.
They triggered the gregarious behaviour by tickling the beasts' hind legs, to simulate the jostling they experience in a crowd.
They found that locusts behaving the most gregariously (in swarm-mode) had approximately three times more serotonin in their systems than their calm, solitary comrades.
"The question of how locusts transform their behaviour in this way has puzzled scientists for almost 90 years," said co-author Dr Michael Anstey, from Oxford University.
"We knew the [physical] stimuli that cause locusts' amazing Jekyll and Hyde-style transformation.