The Queen will address the Scottish Parliament as part of its 20th anniversary celebrations.
Prince Charles will join her as she makes a speech to MSPs in the debating chamber.
The ceremony on June 29 will take place almost 20 years to the day since the Parliament officially assumed its legal powers on July 1 1999 following devolution.
Some of the young people born on that date will join MSPs to hear the Queen’s address and watch performances celebrating Scotland’s music and culture.
The ceremony is part of a year-long programme of events to mark two decades of devolution.
It could take place a day before Brexit, if the EU agrees to Theresa May’s June 30 deadline.
Presiding Officer Ken Macintosh said “Since the Scottish Parliament was established nearly two decades ago, Her Majesty The Queen has given us her unwavering support.
“She addressed the newly elected MSPs in July 1999 as we assumed our legislative powers and she has visited Holyrood many times since. Each time with messages of friendship and support.
“It will be a pleasure to welcome Her Majesty and HRH The Duke of Rothesay to the Parliament once again as we celebrate our 20th year.”
He added: “In the Queen’s address to the Parliament in 1999, she talked about the start of a new constitutional age and the importance of channelling the energy of the young and being open and accessible to serve all the people of Scotland.
“As we look ahead to our next 20 years, these are messages that still resonate and sit at the heart of what we do.”
The visit will be the ninth time the Queen has addressed the Scottish Parliament.
Her last speech to MSPs took place on July 2 2016 as part of celebrations marking the opening the fifth session of the Parliament.
The Prince of Wales, known as the Duke of Rothesay in Scotland, last visited the Parliament in 2006 to attend a reception of the Prince’s Trust.