An electrocardiogram (ECG) is a medical test that monitors the electrical impulses your heart produces. Electrodes from an ECG machine are attached to specific points on your chest, arms and legs. The machine reads your heart's impulses and records them as waves with peaks and valleys which can then reveal problems with your heart.
These electrodes detect the tiny electrical changes on the skin that arise from the heart muscle's electrophysiologic pattern of depolarizing and repolarizing during each heartbeat. It is a very commonly performed cardiology test.