The line of succession determines who will become monarch in Britain when the reigning king or queen dies.
Queen Elizabeth II is currently the longest serving monarch, her time as sovereign lasting more than 65 years.
Succession is not just a matter of convention, but is in place by law, as it is determined by the Act of Settlement of 1701.
When Elizabeth II dies, Prince Charles will become King. The process is automatic - he will be the king the second the Queen dies.
However a number of conventions will be followed in order to install him as the king.
For now, Charles is the heir to the throne, the longest serving heir there has ever been.
His son William is the second in line to the throne. Before William had children, Charles’s second son Prince Harry was third in line.
However Harry was displaced by Prince George, then Princess Charlotte and Prince Louis, who are third, fourth and fifth in line.
Before 2011, men took precedence over women in the line of succession, which meant women could be moved down the line by their younger brothers.
This happened to Princess Anne and to Lady Louise Windsor, but the UK government changed the law before Prince William and Kate had children.
It means Charlotte remains in line at fourth, and her children will also be higher up in line to the throne than Anne’s children are. Louis is fifth in line.
Harry is now sixth in line, and his son Archie is seventh.
Their positions in line to the throne do not change based on whether they are working royals or not - so the fact that Harry and Meghan opted to leave their senior roles behind does not have any impact.
The lack of royal title for their son doesn’t change anything either - Archie is still seventh.
After Harry and his son, the line goes back to the children of the Queen, starting with Prince Andrew, because Anne was bumped down by her younger brothers.
Andrew is eighth, and his children, Princesses Beatrice and Eugenie, are ninth and tenth. They stay where they are because they don’t have any male siblings.
Prince Edward, the Queen’s youngest son, is 11th, and his son James, the Viscount Severn, is 12th. James’s older sister Lady Louise Windsor, is 13th.
Princess Anne finally makes her appearance at 14th. Her children, Peter Phillips and Zara Tindall, like Archie, are in line to the throne even though they and their children don’t have royal titles.
That makes Phillips 15th in line, and his children, Savannah and Isla, are 16th and 17th.
Tindall is 18th and her children, Mia and Lena, are 19th and 20th.
Read more: Who was Prince Philip's other royal family?
After Tindall’s children, there are no more direct descendants of the Queen, so the line reverts to the other descendants of her father, King George VI.
The Queen had one younger sister, the late Princess Margaret. Her son, the Earl of Snowdon, is 21st in line, followed by his children, Charles Armstrong-Jones and Lady Margarita Armstrong-Jones at 22 and 23.
Margaret also had a daughter, Lady Sarah Chatto, who is position 24. Her two children, Samuel Chatto and Arthur Chatto, are 25 and 26.
The line of succession then has to go back again to the generation before the Queen. It reverts to the late King George VI’s younger siblings and their offspring, so the Queen’s cousins.
It includes people like the Duke of Gloucester, who is 27th, and the Duke of Kent, who is 37th. Their descendants make up the line below them.
The lowest ranking senior royal is Princess Alexandra, who is the Queen’s cousin. She is a working royal, and represents more than 100 charities and organisations as president or a patron.
She’s 53rd in line to the throne, with her children and grandchildren completing the line of succession from King George V.
No full list is kept as it’s incredibly unlikely there would be a need to determine succession after the 59th in line to the throne.
Some previous estimates have put more than 4,000 people somewhere in the line of succession.