20 years and 314 days:
Robert Walpole (1721–1742)
18 years and 343 days:
William Pitt the Younger
(1783–1801 and 1804–1806)
14 years and 305 days:
Lord Liverpool (1812–1827)
211 days:
Bonar Law (1922–1923)
144 days:
Lord Goderich (1827–1828)
119 days:
George Canning (1827)

This article lists each Prime Minister of the United Kingdom in order of term length. This is based on the difference between dates; if counted by number of calendar days all the figures would be one greater.

Of the 55 Prime Ministers, nine served more than 10 years while seven have served less than a year.

Robert Walpole is the only person to have served as Prime Minister for more than two decades. George Canning served for less than four months before his death.

Ordered by tenure

In this table, "Terms in office" is the number of separate, discontiguous periods served as Prime Minister.

Rank Prime Minister Length served Terms in office Party Start
1 Sir Robert Walpole 20 years, 314 days 1 Whig 1721
2 William Pitt the Younger 18 years, 343 days 2 Tory (Pittite) 1783
3 The Earl of Liverpool 14 years, 305 days 1 Tory (Pittite) 1812
4 The Marquess of Salisbury 13 years, 252 days 3 Conservative 1885
5 William Ewart Gladstone 12 years, 126 days 4 Liberal 1868
6 Lord North 12 years, 58 days 1 Tory (Northite) 1770
7 Margaret Thatcher 11 years, 208 days 1 Conservative 1979
8 Henry Pelham 10 years, 191 days 1 Whig 1743
9 Tony Blair 10 years, 56 days 1 Labour 1997
10 The Viscount Palmerston 9 years, 141 days 2 Whig / Liberal 1855
11 H. H. Asquith 8 years, 244 days 1 Liberal 1908
12 Sir Winston Churchill 8 years, 239 days 2 Conservative 1940
13 Harold Wilson 7 years, 279 days 2 Labour 1964
14 The Duke of Newcastle 7 years, 205 days 2 Whig 1754
15 Stanley Baldwin 7 years, 82 days 3 Conservative 1923
16 Benjamin Disraeli 6 years, 339 days 2 Conservative 1868
17 Ramsay MacDonald 6 years, 289 days 2 Labour / National Labour 1924
18 Harold Macmillan 6 years, 281 days 1 Conservative 1957
19 The Viscount Melbourne 6 years, 255 days 2 Whig 1834
20 Sir John Major 6 years, 155 days 1 Conservative 1990
21 Clement Attlee 6 years, 92 days 1 Labour 1945
22 David Cameron 6 years, 63 days 1 Conservative 2010
23 Lord John Russell 6 years, 11 days 2 Whig / Liberal 1846
24 David Lloyd George 5 years, 317 days 1 Liberal 1916
25 Sir Robert Peel 5 years, 57 days 2 Conservative 1834
26 The Earl of Derby 3 years, 280 days 3 Conservative 1852
27 Edward Heath 3 years, 259 days 1 Conservative 1970
28 The Earl Grey 3 years, 229 days 1 Whig 1830
29 Arthur Balfour 3 years, 145 days 1 Conservative 1902
30 The Duke of Portland 3 years, 82 days 2 Whig / Tory (Pittite) 1783
31 Henry Addington 3 years, 54 days 1 Tory (Pittite) 1801
32 James Callaghan 3 years, 29 days 1 Labour 1976
33 Theresa May 3 years, 11 days 1 Conservative 2016
34 Neville Chamberlain 2 years, 348 days 1 Conservative 1937
35 The Duke of Wellington 2 years, 320 days 2 Tory 1828
36 Gordon Brown 2 years, 318 days 1 Labour 2007
37 Spencer Perceval 2 years, 221 days 1 Tory (Pittite) 1809
38 Henry Campbell-Bannerman 2 years, 122 days 1 Liberal 1905
39 George Grenville 2 years, 85 days 1 Whig (Grenvillite) 1763
40 The Earl of Chatham 2 years, 76 days 1 Whig (Chathamite) 1766
41 The Earl of Aberdeen 2 years, 42 days 1 Peelite 1852
42 Boris Johnson 1 year, 288 days (incumbent) 1 Conservative 2019
43 Sir Anthony Eden 1 year, 279 days 1 Conservative 1955
44 The Earl of Wilmington 1 year, 119 days 1 Whig 1742
45 The Marquess of Rockingham 1 year, 113 days 2 Whig (Rockinghamite) 1765
46 The Earl of Rosebery 1 year, 109 days 1 Liberal 1894
47 The Duke of Grafton 1 year, 106 days 1 Whig (Chathamite) 1768
48 The Lord Grenville 1 year, 42 days 1 Whig 1806
49 Sir Alec Douglas-Home 363 days 1 Conservative (Scot. Unionist) 1963
50 The Earl of Bute 317 days 1 Tory 1762
51 The Earl of Shelburne 266 days 1 Whig (Chathamite) 1782
52 The Duke of Devonshire 225 days 1 Whig 1756
53 Bonar Law 211 days 1 Conservative (Scot. Unionist) 1922
54 The Viscount Goderich 144 days 1 Tory (Canningite) 1827
55 George Canning 119 days 1 Tory (Canningite) 1827

See also