An electrocardiogram (ECG) is used to check for problems with the electrical activity of your heart. It shows the heart’s electrical activity as line tracings on paper. The spikes and dips in the tracings are called waves. It is used to rule out the cause of unexplained chest pains. It also helps in understanding the functioning of mechanical devices that are implanted in the heart, such as pacemakers.