Harlech Castle (Welsh: Castell Harlech; Welsh pronunciation: [kastɛɬ ˈharlɛχ]) in Harlech, Gwynedd, Wales, is a Grade I listed medieval fortification built onto a rocky knoll close to the Irish Sea. It was built by Edward I during his invasion of Wales between 1282 and 1289 at the relatively modest cost of £8,190. Over the next few centuries, the castle played an important part in several wars, withstanding the siege of Madog ap Llywelyn between 1294 and 1295, but falling to Prince Owain Glyndŵr in 1404. It then became Glyndŵr's residence and military headquarters for the remainder of the uprising until being recaptured by English forces in 1409. During the 15th century Wars of the Roses, Harlech was held by the Lancastrians for seven years, before Yorkist troops forced its surrender in 1468, a siege memorialised in the song "Men of Harlech". Following the outbreak of the English Civil War in 1642, the castle was held by forces loyal to Charles I, holding out until 1647 when it became the last fortification to surrender to the Parliamentary armies. In the 21st century the ruined castle is managed by Cadw, the Welsh Government's historic environment service, as a tourist attraction.

UNESCO considers Harlech, with three others at Beaumaris, Conwy and Caernarfon, to be one of "the finest examples of late 13th century and early 14th century military architecture in Europe", and it is classed as a World Heritage Site. The fortification is built of local stone and concentric in design, featuring a massive gatehouse that probably once provided high-status accommodation for the castle constable and visiting dignitaries. The sea originally came much closer to Harlech than in modern times, and a water-gate and a long flight of steps leads down from the castle to the former shore, which allowed the castle to be resupplied by sea during sieges. In keeping with Edward's other castles in the north of Wales, the architecture of Harlech has close links to that found in the County of Savoy during the same period, an influence probably derived from the Savoy origins of the main architect, James of Saint George.