There are a lot of reasons that can create a smelly washer that can in turn cause a bad odor in the clothes.
Causes of a smelly washer are as follows
1.Extensive use of detergents is the most common cause of a smelly washer. Since there is nothing to resist the detergent from reacting therefore the detergent leaves a residue in the washer which results in the growth of bacteria and mold. This leftover detergent acts as a food source for them and therefore it is important to use the detergent in the right quantity. As we generally wash only sweat and perfume from our clothes therefore very less amount of detergent is required. Maximum of a table spoon should be used for washing the clothes especially if you are using a detergent which is in a liquid form. To avoid smelly washers this tip is important to follow.

2.Another common cause for smelly washers is the use of cold water for washing clothes. You must use hot water as it dissolves the entire residue. Make sure that the hoses of hot water supply are properly connected to the washer.
3.Another common reason for a smelly washer is the seldom usage of the washing machine. You must clean the washing machine with a washing machine cleaner regularly if you do not intend to use it for a long time. Do not forget to switch off the supply hoses if you are going out for a long time.
4.Obstructions that occur in the drain pumps can also be the cause of a smelly washer as they reduce the speed of the water while it gets drained out. There is a filter trap in all the washing machines so before calling up a mechanic read the user manual instructions. Do not forget to unplug your machine before starting to repair it. Few items that can cause the filter to jam are coins, toys, bra wires and screws. Rather than buying a new pump first try to clean the damaged one.
Few remedies for curing a smelly washer are
1.Run baking soda in the washing machine- Run baking soda along with vinegar in your empty machine as vinegar is great for reducing smell in clothes. You have to add a small amount of it with the detergent and then you can get rid of a smelly washer. Wash your machine with it in every three or four weeks.
2.Run your empty washing machine through bleach and hot water- In this way you can kill the bacteria and reduce the harsh odor.
3.Ammonia- Ammonia also works as a great deodorizer and can be easily found in the house. You just have to add a pinch of ammonia to an empty washing machine and run it through hot water cycle. As the mixing together of ammonia and bleach causes toxic fumes so you should always avoid doing so.Thus these are the tried and tested home remedies that can help you get rid of a smelly washer.