What chemicals are responsible for the stench emanating from socks? If it's just sweat, why don't underwear or vests stink as much? Which gas am I inhaling when smelling socks to decide whether they need a wash?
According to the Wikipedia page, aptly named Smelly Socks, it states that the smell
is a mixture of ammonia, fatty acids (in particular, isovaleric acid), and lactic acid.
What makes sock odor unique is that socks often pick up small amounts of organic material when walking around without shoes on. When wearing shoes, they are in a warm semi-enclosed environment with a considerable amount of sweat infusing into them (it can be quite warm and humid in shoes) particularly when exercising. A lot of the smell is due to bacterial action on the bits and pieces trapped in the socks themselves.
Interestingly, the Wikipedia article states that it is a topic of ongoing study, in part due to a possibility that the chemicals could be used in the battle against Malaria - Using smelly socks to attract mosquitoes -- and combat malaria
In addition to the answer posted by @santiago, here is some information from the following article in the UK newspaper Daily Mail:
The article has a video, produced by the American Chemical Society, that explains how the bacteria that live on your skin and in your shoes eat your sweat, producing an acid by-product that causes the smells.
A snippet from the article:
The three main bacterial waste products are propanoic acid, methanethiol and isovaleric acid
Methanethiol makes your feet smell like sulphur and cheese and is produced from dead skin.
Isovaleric acid also has a cheesy aroma, and a rancid vinegar-like scent, while propanoic acid has a rancid sour smell.