There are a number of times that you will need to clean your washing machine to keep it in top working order but most often it will be when you have a musty mold smell.
When mold starts to grow inside your washing machine tub and in your waste lines you can end up with clothes that smell bad and may be unhealthy to wear.
Mold only requires water to begin growing and will grow quickly in the moist warm area near your dryer or in your basement. If you wash towels that have been sitting in the bottom of your hamper wet and beginning to grow mold they can be the starter for mold growing in your washer.
To remove the mold you can use standard clothes washing bleach.
The mixture should be 10% bleach to water so you will need a full gallon to treat your washer tub.
It is important to allow the bleach mixture to sit in the tub for at least 10 minutes but up to 30 or more may be a good idea if you have a serious problem. Allow the tub to fill completely and begin agitating but stop the timer before it continues to the drain cycle.
After the bleach has killed the mold put the washer through a full cycle and add some soap to clean out the rest of the problem.
Reasons mold may be in your washer
If you have a vacation house mold may grow in an unattended washer.
Mold from wet clothes allowed to sit for days can contribute to mold growth.
An under performing or bad drain pump in your washer may leave too much excess water in the tub.
Clogs in the waste line system.
Other Bad Smells that could be dangerous.
If you have a smell of sewage waste gas it may mean that your washer was not installed with a proper trap in the waste line. Traps are similar to the shape of the pipe under your bathroom sink and hold water to prevent sewer gas from exiting any sink, toilet or appliance like your washer that is connected to a waste line.
If you have the smell of waste and not mold you should check your trap for proper function. Gas in waste lines / sewer systems can be explosive but more often it is really disgusting to smell.