If a bad odor in your washing machine has turned doing laundry into an unpleasant task, the smell is probably one of two odors: the musty odor of mildew or the sour smell of bacteria. The mildew smell occurs when wet clothes are left inside traditional top-load washers for hours or days, giving the fungus time to grow on them and spread to the interior of the washer. It occurs in front-load machines when the unit is overloaded with too many items of clothing in the wash. The machine fails to rinse away all dirt after each load, giving mildew a place to grow. The odor of bacteria is caused by overloading both top and front load units. The bacteria feeds on debris the washing machine doesn't rinse away.
Use bleach to eliminate odors in your washing machine. Bleach contains surfactants, which help it destroy organic matter like mildew and bacteria. Pour 1/4 cup of liquid household bleach into a gallon of water. While wearing gloves to protect your skin, use a sponge soaked in the solution to wash out the interior of the washing machine. Focus your attention on the upper portions of the interior, closest to the door. Wipe away any visible mildew or debris, and rinse down the newly-cleaned areas with water. Run a load of just hot water, adding 2 cups of bleach to the load.
If you prefer not to use harsh chemicals in your cleaning, remove odor from your washing machine with pure white vinegar instead. The acetic acid in vinegar kills mildew spores and neutralizes the odors of both mildew and bacteria. Soak a sponge in undiluted vinegar, and clean the interior of the unit. Run an empty load with just hot water. Add 2 tsp. of tea tree oil to the load; it is a natural fungicide and antibacterial agent.
To prevent odors in your washing machine, don't leave wet clothes sitting inside it for longer than half an hour. Avoid overloading units with too much dirty laundry. Because front load units are designed to use less water, they are at greater risk for developing a bad smell because overloading them is easier. To reduce your machine's risk, leave the washer's door open between loads, which reduces moisture inside the unit and makes it less inviting to both mildew and bacteria.