You have two kinds of sweat glands in your skin. ‘Apocrine’ glands exist only on certain parts of your body, such as your armpits and groin area, and produce an oily fluid in response to emotional experiences such as anxiety, pain and arousal. ‘Eccrine’ sweat glands are much more numerous and distributed all over the body, and they’re responsible for your workout sweat.
The purpose of eccrine sweat is to cool down the body as it evaporates from the skin. Eccrine sweat is more than 99 per cent water and completely odourless – at least when it first leaves your pores. But the bacteria on your skin feed on the scant nutrients in the sweat, along with any loose skin flakes.
One of the by-products of their metabolism is a group of sulphur-containing chemicals called thioalcohols. The exact thioalcohols produced will depend on your unique menagerie of skin bacteria, but some thioalcohols do indeed smell strongly of onion. Their whiff is overpowering because our noses are capable of detecting thioalcohols at concentrations of as little as one part in a trillion.
The protein responsible for this part of the bacterial metabolism was identified at the University of York in 2018, giving hope for deodorants that prevent bacteria from producing thioalcohols. Until then, a shower is still the best remedy.