Bleach, vinegar or specially formulated washing machine cleaners remove a musty smell from a washing machine. Odor in a washing machine could be due to build up of detergent, oils, grime, mold or mildew.
To clean inside a washing machine, one should pour either two cups of bleach or two cups of vinegar into the tub. Bleach and vinegar should not be used together. Then, the washer should be run through a normal cycle on the hottest water setting. Alternatively, one can purchase a washing machine cleaner such as Affresh or Washer Magic. These products contain specific instructions for use.
The exterior of the washer should be cleaned as well. One should wipe down the exterior with a vinegar and water solution, taking care to clean around the inside of the lid or door. The rubber door seal of a front-load washer should be checked for mold or mildew and cleaned. The bleach, detergent and fabric softener compartments should be removed and washed.
A musty smell in a washing machine can be prevented. One should leave the lid or door of the washing machine open after each cycle. This allows the interior of the washer to dry thoroughly. Fabric softeners should be avoided as they can promote buildup inside the washing machine.