Moldy onions are a common problem both before and after harvest. Aspergillus niger is a common cause of black mold on onions, including moldy spots, streaks or patches. The same fungus causes black mold on garlic, too.
Onion black mold most commonly occurs post-harvest, affecting bulbs in storage. It can also occur in the field, usually when bulbs are at or near maturity. The fungus enters the onion through wounds, either at the top, on the bulb, or in the roots, or it enters through the drying neck. Symptoms are most commonly seen at the top or neck and may move down. Sometimes black mold destroys the whole bulb.
A. niger is abundant on rotting plant material, and it's also plentiful in the environment, so you can't entirely eliminate exposure to this microbe. Therefore, the best methods of onion black mold control involve prevention.
Sanitation measures (cleaning up your garden beds) will help prevent black mold problems. Ensure good drainage in the field to prevent development of this disease. Consider rotating onions with other crops that are not in the Alliaceae (onion/garlic) family to prevent a disease problem in the next season.
The other major prevention measures involve careful harvest and storage. Avoid damaging or bruising the onions as you harvest them, because wounds and bruises allow the fungus to enter. Properly cure onions for storage, and choose varieties that are known to store well if you plan on storing them for months. Eat any damaged onions immediately, because they won't store as well.
Mild A. niger infections appear as black spots or streaks around the top of the onion and possibly on the sides – or the whole neck area may be black. In this case, the fungus may have invaded just the dry outer scales (layers) of the onion, producing spores between two scales. If you peel off the dry scales and the outermost fleshy scale, you may find that the inner ones are unaffected.
Onions that are mildly affected are safe to eat, as long as the onion is firm and the moldy area can be removed. Peel off the affected layers, cut an inch around the black portion, and wash the unaffected portion. However, people with an allergy to Aspergillus shouldn't eat them.
Severely moldy onions are not safe to eat, especially if they have turned soft. If the onion has softened, other microbes may have taken the opportunity to invade along with the black mold, and these microbes could potentially produce toxins.