The Queen's last visit to Caernarfon was in 1975 when she presented colours to the Royal Welsh regiment.
Six years before that, in July 1969, she was at the castle to officially present Prince Charles to the people of Wales after the pomp and ceremony of his investiture.
On Tuesday, she again stepped out onto the newly refurbished Queen's Gate balcony, this time alongside the duke.
During the visit to Caernarfon Castle, she and the Duke of Edinburgh also viewed the Royal Welch Fusiliers Museum and an exhibition about the investiture.
Caernarfon mayor Hywel Roberts, who is also the deputy constable of the castle, and his wife accompanied the royal visitors who met groups of children and young people.
He said before the visit it would be an "honour and pleasure" to welcome the royal visitors, and it was an "extremely important day" for Caernarfon, providing a huge boost to both the town and the local tourist trade.
BBC archive footage shows the Queen at Carenarfon Castle in 1969 for Prince Charles' investiture
Hundreds of children waved Wales flags and cheered as the royal party made their way through the castle grounds.
After leaving the castle, the couple boarded a black Pullman carriage for a ten-minute journey on the Welsh Highland Railway to Dinas station.
She then unveiled the name of the first class carriage as Glaslyn.
The royal couple's trip continued with a reception and lunch with students and staff at Bangor Business School.
Then the Queen finished her visit to north Wales in Llandudno, Conwy.
The royal party were cheered by several hundred flag-waving youngsters as they arrived at Venue Cymru on the town's seafront.
The Queen and Prince Philip were greeted by Trefor Jones, Lord Lieutenant of Clwyd, before joining in with 'a celebration of volunteering' at the venue.
The royal pair spent time viewing stands devoted to local charities and voluntary groups and watched a performance by Llandudno Youth Music Theatre.
On Wednesday the visit will move to Powys, where the royal couple will meet farmers.
Bookmark with:
What are these?