A wet carpet can easily become a moldy carpet if you allow moisture to remain within the porous carpet fibers. Mold often emerges on carpets following a flood, spill, roof leak or period of high humidity, because the carpet itself provides "food" for mold spores, and the lingering moisture allows those spores to germinate. You can eliminate carpet mold using vinegar, a lightly acidic solution with powerful mold-killing abilities.
Dry your carpet before applying vinegar or any solution. You must first neutralize the active mold spores by removing their moisture. If your carpet is lightly damp -- from humidity, for example -- turn on a dehumidifier. If your carpet is soaked, use a wet-dry vacuum to suck out the liquid.
Pour white vinegar into a spray bottle. If you have only light mildew, you can dilute the vinegar with equal parts water. For heavy mold, just pour the vinegar undiluted into the spray bottle. You should not pour vinegar directly onto the carpet, as this will just provide your carpet with more excessive moisture. By misting the vinegar, you can kill the mold without soaking the carpet again.
Pull up the carpet. If you focus only on the top surface, you may miss the spores beneath and allow new mold to grow. If the padding below the carpet appears moldy or damaged, throw it away and replace it.
Spray both sides of the carpet -- top and bottom -- with vinegar, wherever mold spores or stains appear. You do not need to rinse the vinegar away. The acetic acid will continue to fight mold long after you walk away. Don't worry about the vinegar smell. It will dissipate very shortly. If you want, you can also spray the entire underside of your carpet as a preventive measure.
Dry your carpet again. Even light mists can remain trapped in the highly porous carpet fibers, so do not allow the carpet to air dry on its own. If you only spot treated small areas of the carpet, you can dry the affected areas using a hair dryer. Otherwise, you can turn on a heater or a dehumidifier.
Vacuum your carpet to remove any remaining dried spores.