Very likely, it's because of mold, mildew or both. Here's how to solve the problem.
Washing machines create two of the favorite things for mold and mildew...heat and moisture. Once you detect a mold or mildew smell, take action right away. Waiting will only make the problem worse and result in more stinky clothes coming out of the washer.
First, check above the normal waterline in the washer tub. Soiled water and soap get splashed above the waterline during use and sometimes doesn't drain away properly during the rinse cycle. It just sits there, creating mold and mildew and bacteria. One of the first ways to detect this problem is to smell your laundry that comes out of the washer. If it stinks, it's likely because the clothes have rubbed against the soiled area during the washing process.
So what do you do to attack that smell? There are a few options.
Reach for the bleach. Bleach is the go-to cleaning method for mold and mildew. Just be careful not to use too much, have proper ventilation and wear protective gear on your hands. Also, be careful not to get any on your clothes. One other very important note: If you are using bleach around other chemicals, make sure you read the labels. Mixing bleach and ammonia results in a toxic gas that can be deadly in an enclosed space.
To clean your washer with bleach, add 1 cup of bleach to the bleach dispenser of the washer or directly into the machine itself. Run the cleaning cycle or a hot wash cycle, depending on your washer. This needs to be done without laundry. When the cycle is done, wipe down the inside of the washer and any bleach or fabric softener dispensers inside.
Use vinegar. If you don't want to use bleach, you can try some vinegar. White distilled vinegar will kill mold spores and bacteria. The process is different depending on whether your washer is a top loader or a front loader.
For a top loader,set your washer on the hottest and longest cycle. If you have a cleaning cycle, use that one. Once the washer fills up and begins agitating, add four cups of white distilled vinegar. Close the lid and let the washer agitate for a few minutes and then stop it. Let the water and vinegar mixture sit for about an hour and then close the lid and let the washer continue the cycle. If it still smells when it drains, repeat the process.
For a front loader, select the hot water or cleaning cycle. Pour about a cup of distilled white vinegar into the bleach dispenser. Let the washer go through the cycle and then run an additional rinse cycle. When it finishes, wipe down the inside, remove the bleach and fabric softener dispensers and clean them with warm soapy water. Dry them and replace them. Finally, clean the gasket around the door with a dry towel.
Now that the washer is clean, here are some tips to keep it that way. First, follow the above steps regularly to keep the washer clean. You can also follow these simple steps to keep odors away:
Use your cleaning cycle if you have one. It's a simple thing, but a lot of people forget to do it. Check your washing machine's owners manual for details on how often they recommend using the cleaning cycle.
Keep the washer door open when it's not in use. Doing this allows any moisture inside to evaporate more easily.
Keep things moving. Don't let a load of laundry sit in the washer once it finishes. Put them in the dryer right away and remove them from the dryer quickly after they are done. Warm, wet clothes are easy targets for mold, mildew and bacteria to grow.