<P> Of the 54 Prime Ministers, 9 served more than 10 years while 7 served less than 1 year . </P> <P> Sir Robert Walpole is the only person to have served as Prime Minister for more than 20 years . George Canning served as Prime Minister for less than four months before his death . </P> <Table> <Tr> <Th> Rank by length of terms </Th> <Th> Prime Minister </Th> <Th> Length by time served </Th> <Th> Ministries </Th> <Th> Party </Th> <Th> Start of 1st Administration </Th> </Tr> <Tr> <Td> </Td> <Td> Walpole! Sir Robert Walpole </Td> <Td> 20 years, 314 days </Td> <Td> 6 </Td> <Td> Whig </Td> <Td> 1721 </Td> </Tr> <Tr> <Td> </Td> <Td> Pitt! William Pitt the Younger </Td> <Td> 18 years, 343 days </Td> <Td> 5 </Td> <Td> Pittite (Tory) </Td> <Td> 1783 </Td> </Tr> <Tr> <Td> </Td> <Td> Liverpool! The Earl of Liverpool </Td> <Td> 14 years, 305 days </Td> <Td> 5 </Td> <Td> Tory </Td> <Td> 1812 </Td> </Tr> <Tr> <Td> </Td> <Td> Salisbury! The Marquess of Salisbury </Td> <Td> 13 years, 252 days </Td> <Td> 5 </Td> <Td> Conservative </Td> <Td> 1885 </Td> </Tr> <Tr> <Td> 5 </Td> <Td> Gladstone! William Ewart Gladstone </Td> <Td> 12 years, 126 days </Td> <Td> </Td> <Td> Liberal </Td> <Td> 1868 </Td> </Tr> <Tr> <Td> 6 </Td> <Td> North! Lord North </Td> <Td> 12 years, 58 days </Td> <Td> </Td> <Td> Tory </Td> <Td> 1770 </Td> </Tr> <Tr> <Td> 7 </Td> <Td> Thatcher! Margaret Thatcher </Td> <Td> 11 years, 209 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> 1979 </Td> </Tr> <Tr> <Td> 8 </Td> <Td> Pelham! Henry Pelham </Td> <Td> 10 years, 191 days </Td> <Td> </Td> <Td> Whig </Td> <Td> 1743 </Td> </Tr> <Tr> <Td> 9 </Td> <Td> Blair! Tony Blair </Td> <Td> 10 years, 56 days </Td> <Td> </Td> <Td> Labour </Td> <Td> </Td> </Tr> <Tr> <Td> 10 </Td> <Td> Palmerston! The Viscount Palmerston </Td> <Td> 9 years, 141 days </Td> <Td> </Td> <Td> Whig </Td> <Td> 1855 </Td> </Tr> <Tr> <Td> 11 </Td> <Td> Asquith! H.H. Asquith </Td> <Td> 8 years, 244 days </Td> <Td> </Td> <Td> Liberal </Td> <Td> 1908 </Td> </Tr> <Tr> <Td> 12 </Td> <Td> Churchill! Sir Winston Churchill </Td> <Td> 8 years, 239 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> 1940 </Td> </Tr> <Tr> <Td> 13 </Td> <Td> Wilson! Harold Wilson </Td> <Td> 7 years, 279 days </Td> <Td> </Td> <Td> Labour </Td> <Td> 1964 </Td> </Tr> <Tr> <Td> 14 </Td> <Td> Newcastle! The Duke of Newcastle </Td> <Td> 7 years, 205 days </Td> <Td> </Td> <Td> Whig </Td> <Td> 1754 </Td> </Tr> <Tr> <Td> 15 </Td> <Td> Baldwin! Stanley Baldwin </Td> <Td> 7 years, 82 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> 1923 </Td> </Tr> <Tr> <Td> 16 </Td> <Td> Disraeli! Benjamin Disraeli </Td> <Td> 6 years, 339 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> 1868 </Td> </Tr> <Tr> <Td> 17 </Td> <Td> Macdonald! Ramsay MacDonald </Td> <Td> 6 years, 289 days </Td> <Td> </Td> <Td> Labour / National Labour </Td> <Td> 1924 </Td> </Tr> <Tr> <Td> 18 </Td> <Td> Macmillan! Harold Macmillan </Td> <Td> 6 years, 281 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> 1957 </Td> </Tr> <Tr> <Td> 19 </Td> <Td> Melbourne! The Viscount Melbourne </Td> <Td> 6 years, 255 days </Td> <Td> </Td> <Td> Whig </Td> <Td> 1834 </Td> </Tr> <Tr> <Td> 20 </Td> <Td> Major! Sir John Major </Td> <Td> 6 years, 154 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> </Td> </Tr> <Tr> <Td> 21 </Td> <Td> Attlee! Clement Attlee </Td> <Td> 6 years, 92 days </Td> <Td> </Td> <Td> Labour </Td> <Td> 1945 </Td> </Tr> <Tr> <Td> 22 </Td> <Td> Cameron! David Cameron </Td> <Td> 6 years, 63 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> </Td> </Tr> <Tr> <Td> 23 </Td> <Td> Russell! Lord John Russell </Td> <Td> 6 years, 11 days </Td> <Td> </Td> <Td> Whig </Td> <Td> 1864 </Td> </Tr> <Tr> <Td> 24 </Td> <Td> George! David Lloyd George </Td> <Td> 5 years, 317 days </Td> <Td> </Td> <Td> Liberal </Td> <Td> 1916 </Td> </Tr> <Tr> <Td> 25 </Td> <Td> Peel! Sir Robert Peel </Td> <Td> 5 years, 57 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> 1834 </Td> </Tr> <Tr> <Td> 26 </Td> <Td> Derby! The Earl of Derby </Td> <Td> 3 years, 280 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> 1852 </Td> </Tr> <Tr> <Td> 27 </Td> <Td> Heath! Edward Heath </Td> <Td> 3 years, 259 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> 1970 </Td> </Tr> <Tr> <Td> 28 </Td> <Td> Grey! The Earl Grey </Td> <Td> 3 years, 229 days </Td> <Td> </Td> <Td> Whig </Td> <Td> 1830 </Td> </Tr> <Tr> <Td> 29 </Td> <Td> Balfour! Arthur Balfour </Td> <Td> 3 years, 145 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> 1902 </Td> </Tr> <Tr> <Td> 30 </Td> <Td> Portland! The Duke of Portland </Td> <Td> 3 years, 82 days </Td> <Td> </Td> <Td> Whig / Tory </Td> <Td> 1783 </Td> </Tr> <Tr> <Td> 31 </Td> <Td> Addington! Henry Addington </Td> <Td> 3 years, 54 days </Td> <Td> </Td> <Td> Tory </Td> <Td> 1801 </Td> </Tr> <Tr> <Td> 32 </Td> <Td> Callaghan! James Callaghan </Td> <Td> 3 years, 29 days </Td> <Td> </Td> <Td> Labour </Td> <Td> 1976 </Td> </Tr> <Tr> <Td> 33 </Td> <Td> Chamberlain! Neville Chamberlain </Td> <Td> 2 years, 348 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> 1937 </Td> </Tr> <Tr> <Td> 34 </Td> <Td> Wellington! The Duke of Wellington </Td> <Td> 2 years, 320 days </Td> <Td> </Td> <Td> Tory </Td> <Td> 1828 </Td> </Tr> <Tr> <Td> 35 </Td> <Td> Brown! Gordon Brown </Td> <Td> 2 years, 319 days </Td> <Td> </Td> <Td> Labour </Td> <Td> 2007 </Td> </Tr> <Tr> <Td> 36 </Td> <Td> Perceval! Spencer Perceval </Td> <Td> 2 years, 221 days </Td> <Td> </Td> <Td> Tory </Td> <Td> 1809 </Td> </Tr> <Tr> <Td> 37 </Td> <Td> Bannerman! Henry Campbell - Bannerman </Td> <Td> 2 years, 122 days </Td> <Td> </Td> <Td> Liberal </Td> <Td> 1905 </Td> </Tr> <Tr> <Td> 38 </Td> <Td> Grenville, George! George Grenville </Td> <Td> 2 years, 85 days </Td> <Td> </Td> <Td> Whig (Grenvillite) </Td> <Td> 1763 </Td> </Tr> <Tr> <Td> 39 </Td> <Td> Chatham! The Earl of Chatham </Td> <Td> 2 years, 76 days </Td> <Td> </Td> <Td> Whig (Chathamite) </Td> <Td> 1766 </Td> </Tr> <Tr> <Td> 40 </Td> <Td> Aberdeen! The Earl of Aberdeen </Td> <Td> 2 years, 42 days </Td> <Td> </Td> <Td> Peelite </Td> <Td> 1852 </Td> </Tr> <Tr> <Td> 41 </Td> <Td> Eden! Sir Anthony Eden </Td> <Td> 1 year, 279 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> 1955 </Td> </Tr> <Tr> <Td> 42 </Td> <Td> Wilmington! The Earl of Wilmington </Td> <Td> 1 year, 136 days </Td> <Td> </Td> <Td> Whig </Td> <Td> 1742 </Td> </Tr> <Tr> <Td> 43 </Td> <Td> Rockingham! The Marquess of Rockingham </Td> <Td> 1 year, 113 days </Td> <Td> </Td> <Td> Whig (Rockinghamite) </Td> <Td> 1765 </Td> </Tr> <Tr> <Td> 44 </Td> <Td> Rosebery! The Earl of Rosebery </Td> <Td> 1 year, 109 days </Td> <Td> </Td> <Td> Liberal </Td> <Td> 1894 </Td> </Tr> <Tr> <Td> 45 </Td> <Td> Grafton! The Duke of Grafton </Td> <Td> 1 year, 106 days </Td> <Td> </Td> <Td> Whig (Chathamite) </Td> <Td> 1768 </Td> </Tr> <Tr> <Td> 46 </Td> <Td> May! Theresa May </Td> <Td> 7002430000000000000 ♠ 1 year, 65 days (Incumbent) </Td> <Td> </Td> <Td> Conservative </Td> <Td> 2016 </Td> </Tr> <Tr> <Td> 47 </Td> <Td> Grenville, William! The Lord Grenville </Td> <Td> 1 year, 42 days </Td> <Td> </Td> <Td> Whig </Td> <Td> 1806 </Td> </Tr> <Tr> <Td> 48 </Td> <Td> Home! Sir Alec Douglas - Home </Td> <Td> 362 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> 1963 </Td> </Tr> <Tr> <Td> 49 </Td> <Td> Bute! The Earl of Bute </Td> <Td> 317 days </Td> <Td> </Td> <Td> Tory </Td> <Td> 1762 </Td> </Tr> <Tr> <Td> 50 </Td> <Td> Shelburne! The Earl of Shelburne </Td> <Td> 266 days </Td> <Td> </Td> <Td> Whig (Chathamite) </Td> <Td> 1782 </Td> </Tr> <Tr> <Td> 51 </Td> <Td> Devonshire! The Duke of Devonshire </Td> <Td> 225 days </Td> <Td> </Td> <Td> Whig </Td> <Td> 1756 </Td> </Tr> <Tr> <Td> 52 </Td> <Td> Law! Bonar Law </Td> <Td> 211 days </Td> <Td> </Td> <Td> Conservative </Td> <Td> 1922 </Td> </Tr> <Tr> <Td> 53 </Td> <Td> Goderich! The Viscount Goderich </Td> <Td> 130 days </Td> <Td> </Td> <Td> Tory (Canningite) </Td> <Td> 1827 </Td> </Tr> <Tr> <Td> 54 </Td> <Td> Canning! George Canning </Td> <Td> 119 days </Td> <Td> </Td> <Td> Tory (Canningite) </Td> <Td> 1827 </Td> </Tr> </Table> <Tr> <Th> Rank by length of terms </Th> <Th> Prime Minister </Th> <Th> Length by time served </Th> <Th> Ministries </Th> <Th> Party </Th> <Th> Start of 1st Administration </Th> </Tr>

List of prime ministers of uk by time in office
find me the text answering this question