How it's performed
Before having a pacemaker fitted, you'll have a preoperative assessment.
The team looking after you will check you're fit for surgery. You can discuss the operation and ask any questions at the assessment.
Some tests may be performed, including blood tests and an electrocardiogram (ECG).
You'll be asked about your general health and heart problems, and how they affect you.
You'll also be asked about any additional medical problems and previous operations you have had, as well as any problems or reactions you or your family have had with anaesthetics.
Taking steps to improve your health and fitness, such as stopping smoking if you smoke, eating a healthy diet and exercising regularly, should help speed up your recovery time and reduce the risk of complications.
You'll usually be told when you have to stop eating or drinking before surgery during the preoperative assessment.
Read more about preparing for surgery.
The pacemaker implantation will be carried out by a heart specialist, known as a cardiologist, who will probably have a special interest in pacemakers.
If you're being treated in a large heart hospital, the operation will often be carried out by an electrophysiologist. This is a cardiologist who specialises in heart rhythm disorders.
Fitting the pacemaker
Transvenous implantation is the most common method of fitting a pacemaker or an implantable cardioverter defibrillator (ICD).
During transvenous implantation, the cardiologist will make a 5 to 6cm (about 2 inch) cut just below your collarbone, usually on the left side of the chest, and insert the wires of the pacemaker (pacing leads) into a vein.
The pacing leads are guided along the vein into the correct chamber of your heart using X-ray scans. They then become lodged in the tissue of your heart.
The other ends of the leads are connected to the pacemaker, which is fitted into a small pocket created by the cardiologist between the skin of your upper chest and your chest muscle.
Transvenous implantation is carried out under local anaesthetic, which is given as an injection.
This means the area where the cuts are made is numbed, but you remain awake during the procedure.
You'll feel an initial burning or pricking sensation when the cardiologist injects the local anaesthetic.
The area will soon become numb, but you may feel a pulling sensation during the operation.
Before the procedure, a thin tube called an intravenous (IV) line will be attached to one of your veins.
Medication to make you drowsy will be given through the IV line to keep you relaxed during the procedure.
The procedure usually takes about an hour, but it may take longer if you're having a biventricular pacemaker with 3 leads fitted or other heart surgery at the same time.
You'll usually need to stay in hospital overnight and have a day's rest after the procedure.
Read more about recovering from a pacemaker implantation.
Epicardial implantation is an alternative and less widely used method of fitting a pacemaker.
In this method, the pacing lead or leads are attached to the outer surface of your heart (epicardium) through a cut in your abdomen, below the chest.
Epicardial implantation is often used in children and people who have heart surgery at the same time as a pacemaker implantation.
It's carried out under general anaesthetic, which means you'll be asleep throughout the procedure.
The surgeon will attach the tip of the pacing lead to your heart and the other end of the lead is attached to the pacemaker box. This is usually placed in a pocket created under the skin in your abdomen.
The procedure usually takes between 1 and 2 hours, but it can take longer if you're having other heart surgery at the same time.
Recovery after epicardial implantation usually takes longer than after transvenous implantation.
Implantable cardioverter defibrillators (ICDs)
In most cases, implantable cardioverter defibrillators (ICDs) are fitted transvenously, along a vein. But they can also be fitted under the skin (subcutaneously).
During the procedure, a pocket will be created in the left side of the chest where the ICD will be positioned.
The pacing lead and electrodes are also placed under the skin along the breast bone and are connected to the device.
After the cuts have been closed, the sensing, pacing and recording functions of the ICD will be tested and adjusted.
Fitting an ICD can take 1 to 3 hours depending on the type of device you're having fitted.
An overnight stay in hospital is often, although not always, required.
Testing and setting the pacemaker
Once the leads are in place, but before they're connected to the pacemaker or ICD, the cardiologist will test them to make sure they work properly and can increase your heart rate. This is called pacing.
Small amounts of energy are delivered through the leads into the heart, which cause it to contract and pull inwards.
When the leads are being tested, you may feel your heart beat faster. Tell the medical team about any symptoms you feel.
Your doctor will adjust the settings of your pacemaker after deciding how much electrical energy is needed to stimulate your heartbeat.
How long you'll have to wait to have a pacemaker fitted will depend on why surgery is required.
If it's needed to treat a potentially serious condition, such as severe heart block or cardiac arrest, surgery is often performed as an emergency.
If the reason for surgery isn't thought to be life threatening, you may have to wait up to 18 weeks.
In most cases, surgery is carried out as soon as possible once it's been decided that you would benefit from a pacemaker.
Read more about NHS waiting times.