A pacemaker is a small device that helps regulate the heartbeat. It works by sending electrical impulses to the heart muscle, which controls the rate and rhythm of the heartbeat. Pacemakers are often used to treat arrhythmias (irregular or abnormal heartbeats) and can help improve a person's quality of life. The device is usually implanted in the chest or abdomen and is connected to the heart through wires called leads.