Caernarfon Castle is a medieval fortress in Caernarfon, Gwynedd, north-west Wales cared for by Cadw, the Welsh Government's historic environment service. There was a motte-and-bailey castle in the town of Caernarfon from the late 11th century until 1283 when King Edward I of England began replacing it with the current stone structure. The Edwardian town and castle acted as the administrative centre of north Wales and as a result the defences were built on a grand scale. There was a deliberate link with Caernarfon's Roman past and the Roman fort of Segontium is nearby.
While the castle was under construction, town walls were built around Caernarfon. The work cost between £20,000 and £25,000 from the start until the end of work in 1330. Despite Caernarfon Castle's external appearance of being mostly complete, the interior buildings no longer survive and many of the building plans were never finished. The town and castle were sacked in 1294 when Madog ap Llywelyn led a rebellion against the English. Caernarfon was recaptured the following year. During the Glyndwr Rising of 1400–1415, the castle was besieged. When the Tudor dynasty ascended to the English throne in 1485, tensions between the Welsh and English began to diminish and castles were considered less important. As a result, Caernarfon Castle was allowed to fall into a state of disrepair.
Despite its dilapidated condition, during the English Civil War Caernarfon Castle was held by Royalists, and was besieged three times by Parliamentarian forces. This was the last time the castle was used in war. Caernarfon Castle was neglected until the 19th century when the state funded repairs. In 1911, Caernarfon Castle was used for the investiture of the Prince of Wales, and again in 1969. It is part of the World Heritage Site "Castles and Town Walls of King Edward in Gwynedd".