When storing whole, unpeeled bulb onions, there are a few things to keep in mind. First things first: Keep them in a spot that’s cool, dark, and dry.
Ventilation is also important—if you don’t keep them in a spot where they can get lots of air circulation, you’ll cut down their shelf life (that’s why keeping them whole in zip-top bags or airtight containers isn’t ideal).
You can store them in containers with air holes, breathable mesh bags, or even pantyhose (yes, seriously).
“Take a pair of [clean] pantyhose, drop an onion down into the toe, and tie a knot above it.” Repeat that process with your remaining onions and hang it in a cool, dark cabinet. “There’s no better way to maximize airflow around your onions while simultaneously keeping them separated and moisture-free. Whenever you need an onion, simply snip one off.”
While it’s not recommended to store whole, unpeeled onions in the fridge (they’ll absorb moisture and become mushy more quickly that way), you should absolutely store them in the fridge if they are peeled, cut in half, or sliced.
Store peeled, halved, and sliced onions in airtight glass containers (plastic may absorb their smell) in the fridge; peeled onions will last about two weeks this way, and sliced onions will last for a week to 10 days. Cooked onions should also be stored in the fridge (airtight containers again, for the win) for three to five days.