An electrocardiogram (ECG) is a recording of the electrical activity of the heart. The vast majority of electrocardiograms are recorded by placing electrodes on various sites on the body surface, typically the limbs and the chest.

A standard 12-lead electrocardiogram uses one electrode placed on each limb, and 6 electrodes around the front and left-hand side of the chest. Fewer electrodes are usually used for longer periods of monitoring (hours or days) - typically 3 to 5 electrodes. Much larger numbers of electrodes (60 to 120) give some additional information, but are inconvenient to apply, so are mainly used for research purposes; this is sometimes known as body surface potential mapping.

Internal electrocardiograms may also be recorded by implanted devices (such as a pacemaker or implantable cardioverter defibrillator), or by electrodes placed temporarily within the heart as a part of an electrophysiology study.

Recording an electrocardiogram is nowadays a simple procedure. Small tabs are positioned at the required positions on the skin; skin preparation by shaving hair, swabbing with alcohol, or slightly roughening the area, may be required. The tabs consist of a plastic backing, a skin adhesive, a metal electrode, and a conductive gel, which usually contains silver chloride. A wire is attached to each tab, the other end of which is attached to the electrocardiograph (ECG machine).

The electrocardiograph filters and processes the electrical signals received; modern digital machines sample the electrical data at a fixed frequency. The data may be stored for later use, but is generally either displayed in real time on a monitor or printed on paper. In the latter case, there are international standards for how the data is printed: the voltage (on the vertical axis) is displayed at 1 cm/mV, and the "paper speed" (time, horizontal axis) is shown at 2.5 cm/s. Values half or twice these, or higher, may be used for special purposes. Some countries always use a paper speed of 5 cm/s.

The single most useful piece of information recorded is the heart rate. The electrocardiograms are described in terms of several named components, most importantly: the P waves, the Q, R and S waves (together known as the QRS complex), and the T waves. There is information in the shape and magnitude of each of these, as well as the intervals betwen them such as the PR interval, QRS width and QT interval. The gap between the end of the QRS complex and beginning of the T wave is known as the ST segment, and is particularly important in the diagnosis of acute myocardial infarction and myocardial ischaemia. The appearance of each of these components varies according to the positioning of the electrode used to record it, and this may give information on where in the heart an abnormality is. The mean QRS axis (often just called the axis) is the vector of the wave ofdepolarisation of the ventricular myocardium (roughly speaking the general direction in which the electrical activation of the heart muscle is proceeding), which may be altered by the size and orientation of the heart, as well as certain conduction abnormalities.

A normal electrocardiogram does not exclude heart disease. Conversely, an electrocardiogram may be abnormal, at least in some cases, in almost any heart disorder. Abnormalities in parts of the heart without heart muscle - such as the heart valves and pericardium - which do not have any electrical activity of their own - can only affect the ECG indirectly. The electrocardiogram is particularly important in the diagnosis of myocardial infarction and ischaemia, and of arrhythmias and conduction system disease. The electrocardiogram gives information in assessing other disorders, such as the enlargement of cardiac chambers, cardiomyopathies, valve disorders and congenital heart disease, but other diagnostic techniques, such as echocardiography or cardiac catheterisation may be more useful.