Timeline of prime ministers of Great Britain and the United Kingdom

This is a graphical timeline of prime ministers of Great Britain and the United Kingdom from when the first prime minister of Great Britain in the modern sense, Robert Walpole, took office in 1721, until the present day.

From 1801 until 1922, British prime ministers also held the office for the whole of Ireland.

Career-based timeline
This timeline shows most of the early life, the political career and death of each prime minister of the United Kingdom from 1846. The first prime minister was Robert Walpole in the early 18th century.

Unlike countries where the leader is elected directly to the highest political office of a separate executive, the prime minister must first establish a political career in the UK Parliament and typically serves many years in the House of Commons before becoming prime minister, and in some cases for many years afterwards.

Since the Marquess of Salisbury in 1895, all time in parliamentary service before being prime minister has been in the House of Commons, apart from Sir Alec Douglas-Home's period as a member of the Government while in the House of Lords (1951–63; though he was previously the elected member for Lanark, 1931–1945). After becoming prime minister, Douglas-Home returned to the Commons by winning a by-election on the recess death of MP Gilmour Leburn.

Uniquely, Cameron's brief parliamentary activity as Foreign Secretary from November 2023 to July 2024 was served while a member of the House of Lords.

Key

 * Each dark coloured bar denotes the time spent as prime minister
 * A light colour denotes time spent in Parliament before or after serving as prime minister
 * A grey colour bar denotes the time the prime minister spent outside the House of Commons or the entire Parliament, either before or after their political career

Notable moments since 1800

 * two separate periods in office: Russell, Palmerston, Disraeli, MacDonald, Churchill, Wilson
 * three separate periods in office: Derby, Salisbury, Baldwin
 * four separate periods in office: Gladstone
 * crossed the floor: Palmerston, Derby, Gladstone, Churchill (twice)
 * died in office: Canning, Palmerston, Perceval (assassinated)
 * died less than six months after leaving office: Portland, Campbell-Bannerman, Law, Chamberlain
 * left Parliament on leaving office: Russell, Baldwin, Blair
 * lived for more than twenty years after leaving the House of Commons: Macmillan, Douglas-Home, Thatcher, Major
 * less than twenty years in Parliament before being prime minister: Baldwin, Chamberlain, Wilson, Major, Blair, Cameron, May, Johnson, Truss, Sunak, Starmer
 * more than twenty years in Parliament after being prime minister: Rosebery, Balfour, Lloyd George, Heath
 * served as prime minister after an interruption to their parliamentary career: MacDonald, Churchill, Macmillan (twice), Douglas-Home, Johnson
 * served as prime minister for two monarchs: Walpole, Newcastle, Liverpool, Wellington, Melbourne, Peel, Salisbury, Asquith, Churchill, Truss
 * served as prime minister for three monarchs: Baldwin
 * served as prime minister for less than two months: Truss
 * over 65 years of age when first appointed: Palmerston, Campbell-Bannerman, Aberdeen, Chamberlain, Grey, Churchill
 * under 45 years of age when first appointed: Goderich, Walpole, Blair, Addington, Cameron, Sunak, Liverpool