People are more likely to wash their hands when they have been shamed into it, research suggests.
A London School of Hygiene And Tropical Medicine team used sensors to examine the reactions to hygiene messages displayed in service station toilets.
The message which produced the highest rate of hand-washing was "Is the person next to you washing with soap?".
The American Journal of Public Health study stresses hand washing is the best way to stop the spread of disease.
It can combat the transmission of major global killers such as diarrhoeal disease and flu, as well as hospital-acquired infections such as Clostridium difficile.
However, researcher Robert Aunger said: "It's difficult to know what kind of message is most effective at changing this everyday behaviour, so it's important to experimentally test what works best in a real setting.
"That way you can save money and make sure your programme will be effective prior to rolling out any public health campaign at great expense."
In total, 250,000 people were counted using the toilets and their use of soap was monitored by on-line sensors.
Only 32% of men washed their hands with soap. For women, the figure was nearly twice as high, at 64%.
A variety of messages, ranging from "water doesn't kill germs, soap does" to "don't be a dirty soap dodger", were flashed onto LED screens at the entrance of the toilets.
The effects of the messages on behaviour were measured.
The message "Is the person next to you washing with soap?" boosted rates of hand-washing with soap by 11% in women and 12% in men.
The researchers suggested people were most sensitive to the idea that others were watching their behaviour.
Mrs Gaby Judah, who led the study, said: "What other people think - what is deemed to be acceptable behaviour - is probably a key determinant in shaping behaviour.
"It was interesting to see that, for men, the more people there were in the toilet, the more likely they were to wash their hands with soap."
Dr Valerie Curtis, director of the London School's hygiene centre, said: "It is very embarrassing to be thought of as dirty by others, even by strangers.
"That's why we expected it to work, but not that it would be the best way of getting people to hand-wash."
There were differences in behaviour by gender, with women responding to reminders, while men tended to react best to messages that invoked disgust, for example "soap it off or eat it later".
The study is released on Global Hand-washing Day, designed to raise awareness of the fact that good hand hygiene can play a significant role in helping to cut disease.
Dr Curtis said: "Hand-washing is one of the most effective interventions in preventing disease, especially in developing countries where over 1.5m kids a year die from diarrhoeal disease.
"Hand-washing with soap could prevent half these deaths-saving a million lives a year."