Caerphilly (Welsh: Caerffili) is a town in Glamorgan, Wales, located at the bottom of the Rhymney Valley. It is the site of Caerphilly Castle, built in the 13th and 14th centuries, and is the main town in the county borough of Caerphilly.