An electrocardiogram, or ECG, is a diagnostic tool that measures the electrical activity of the heart. This information can be used to diagnose cardiac conditions, such as arrhythmias or heart attacks. An ECG is typically performed in a hospital or doctor’s office. The test is quick and painless, and it can provide valuable information about the health of your heart.