A commutator is an electrical switch that periodically reverses the current in an electric motor or electrical generator. It enables a motor to run on, and a generator to produce, a direct current instead of an alternating current.

It typically consists of a set of copper contacts fixed around the circumference of the rotating part of the machine (the rotor), and a set of carbon brushes fixed to the stationary part of the machine (the stator) that complete the electrical circuit from the rotor's windings to the outside of the machine. Friction between the copper contacts and the brushes eventually causes wear to both surfaces. The carbon brushes, being made of a softer material, wear faster and are designed to be replaced easily without dismantling the machine. The copper contacts are usually inaccessible and are not designed to be repaired.