You pick up a knife, make the first cut, and about thirty seconds later your eyes start watering. It happens quickly enough that it still catches people by surprise, even people who cook daily. The thing worth noting is that the onion is doing this deliberately — or at least, what passes for deliberately in the world of plants.
What the onion is actually trying to do
Onions evolved underground. Their main threats are soil insects and the mouths of animals — specifically, being eaten. Over a very long time, they developed a two-part chemical defence that only activates when the plant is damaged.
While the onion is intact, two chemicals sit in separate compartments of its cells: a group of sulphur-containing compounds called amino acid sulphoxides, and an enzyme called alliinase. The two do not contact each other under normal circumstances. When you cut the onion, you breach those compartments and the chemicals mix.
The enzyme acts on the sulphoxides and produces several reactive compounds, one of which is syn-propanethial-S-oxide. This is the lachrymatory factor — the actual irritant. It vaporises almost immediately and disperses into the air around the cutting board.
What it does to your eyes
Syn-propanethial-S-oxide is a mild sulphenic acid in gas form. When it reaches the surface of your eye, it reacts with water in the lacrimal fluid to form small amounts of sulphuric acid. The concentration is low enough that no permanent damage occurs, but the nerve endings in the cornea — which are quite sensitive to acid — detect it and send an immediate distress signal.
The lacrimal glands respond by producing tears at a higher rate than usual, trying to flush the irritant out. That is the crying. It is exactly the same mechanism as when you get something in your eye physically — the tears are a defensive response, not an emotional one.
The onion does not know you are there. It cannot. But the chemistry that makes you cry was specifically selected because it works on the kind of creatures that might eat an onion. That includes humans.
Why chilling the onion helps
A cold onion produces fewer tears. Partly this is because vapour dispersal is slower at lower temperatures. The lachrymatory factor still forms, but it hangs around the surface of the onion longer before reaching your eyes, and some of it condenses before getting anywhere near you.
The enzyme alliinase is also somewhat less active at lower temperatures. The reaction still happens, but more slowly, so less lachrymatory factor is produced per unit of time. This is why serious cooks who work with large quantities of onions often refrigerate them for an hour before prep.
The goggles solution, and why it works
Swim goggles work because they simply prevent the gas from reaching the eye surface. This is not elegant but it is effective. Some people also run a kitchen fan or cut near an open window — moving the air away from the face before the vapour can reach eye level. The chemistry is unchanged; the geometry of dispersal is altered.
There is also a variety of onion bred to have reduced lachrymatory factor — most notably the Sunion, developed after years of selective breeding and introduced commercially in 2018. It tastes different from a standard onion, which is a trade-off not everyone wants to make. The crying, for many cooks, is just the cost of the flavour.