Yes, an electrocardiogram (ECG) can detect heart failure. In fact, an ECG is one of the first tests that a doctor may order when evaluating a patient for heart failure. An ECG measures the electrical activity of the heart and can identify abnormal rhythms or patterns that may indicate heart failure. However, an ECG alone cannot definitively diagnose heart failure and other tests, such as an echocardiogram or blood tests, may be needed to confirm a diagnosis.