Most often it is cheaper to repair a washing machine than to replace, unless the appliance is old and needs multiple replacement parts. A good rule of thumb is to fix the machine as long as the repair costs are less than half the cost of a new appliance.
A new washing machine costs $700 to $1,300 and should last 10 years. If you elect to replace the washing machine, it will likely no longer match the dryer since styles change every few years. Buying a matching washer & dryer set costs $1,000 to $2,300.