Whole onions store well for two to three months in the pantry or refrigerator when properly packaged. Check onions in storage regularly, and use the oldest first, so they don't begin to spoil before you can cook with them.
Onions store best in a cool, dark pantry, where the humidity is low and moisture isn't a concern. You can also store them in the refrigerator, but this isn't necessary for most onions. Store whole onions in paper bags with holes punched in them, or in netted bags, because these allow air circulation. Hanging the bags of onions further increases air circulation and may decrease bruising. Avoid storing onions in enclosed plastic bags, because this can cause them to rot.
Sweet onions contain more moisture, so they are more likely to rot during prolonged storage. You can increase their storage life by storing them in the refrigerator. Wrap each onion individually in a paper towel before storing it.