Tomatoes and Onions
Beneficial Pair — Good Match
Alliums genuinely do produce strong sulfur compounds, so the theory isn't implausible. Nobody we're aware of has run a trial isolating onions next to tomatoes specifically, as opposed to testing alliums as a broad category near various vegetables. This is a pairing that persists because it's low-risk and efficient with bed space, not because the scent-masking claim has been confirmed.
Mechanism: Pest Masking (Scent Confusion)
Onions release sulfur-based volatile compounds from their leaves and bulbs, and that strong scent is the usual reason given for planting them at a tomato's base - the theory runs parallel to basil's aromatic-oil masking effect, just through a different chemical pathway, with the idea being that a sharp-smelling neighbor makes it harder for scent-hunting pests like the tomato hornworm moth to zero in on a tomato plant to lay eggs on.
Tomatoes and onions end up next to each other in more vegetable gardens than almost any other allium pairing besides garlic, mostly because the two want the same sun and similar water and make efficient use of bed space, not because of one dramatic proven benefit.
A Different Advantage From the Basil Pairing
Tomatoes are already commonly interplanted with basil for a similar scent-based reason, so it's worth being specific about what onions add beyond that: an onion planting is already occupying otherwise-bare soil weeks before a transplanted tomato even goes in, which means less open ground for weeds to take over during the tomato's slow early growth phase, and a head start that basil - planted at the same time as the tomato - can't offer.
Spacing
Onions' compact 4-6 inch spacing tucks easily into the soil around a staked tomato, in much the same spot gardeners often use for basil. Keep onions roughly 8-10 inches out from the tomato's main stem so neither crowds the other as the tomato's root system spreads wider over the season.
Watch For
Onions are frost-hardy and can go in the ground weeks before tomatoes are safe to transplant, so most gardeners get the onion planting established first and set tomatoes into the remaining gaps once onions are already growing. Where the two meet, keep an eye on moisture - onions prefer slightly drier soil than a heavily-watered tomato bed, and constant dampness at the bulb raises rot risk.
Frequently Asked Questions
Will onions actually keep hornworms off my tomatoes?
Possibly, but don't rely on it as your only defense - the scent-masking theory is unconfirmed for this specific pairing. Handpicking hornworms or using a floating row cover during moth season are still the dependable methods if you're seeing real damage.