An electrocardiogram (ECG or EKG) is a medical test that records the electrical activity of the heart over a period of time. It is a non-invasive procedure that uses electrodes placed on the skin to detect the electrical signals produced by the heart each time it beats. The data is then represented graphically, allowing physicians to assess the heart's rhythm, electrical conduction, and detect abnormalities.