When their green tops begin to die on their own (usually in early summer), stop watering. Lift the onions when the tops are mostly dead, leaving them to cure on dry ground for a few days. When the tops are totally dry, pull them off. Then brush the dirt off the bulbs and store them in a dark, cool, airy place.
More: How to grow onions