Caerphilly, a market town of Glamorganshire, Wales, 152¼ m. from London by rail via Cardiff, 7 m. from Cardiff, 12 m. from Newport and 6 m. from Pontypridd. The origin of the name is unknown. It was formerly in the ancient parish of Eglwysilan, but from that and Bedwas (Mon.) an ecclesiastical parish was formed in 1850, while the whole of the parishes of Eglwysilan and Llanfabon, with a total acreage of 14,426, were in 1893 constituted into an urban district; its population in 1901 was 15,385, of which 4343 were in the "town" ward. In 1858 was opened the Rhymney railway from Rhymney to Caerphilly and on to Taff's Well, whence it had running powers over the Taff Vale railway to Cardiff, but in 1871, by means of a tunnel about 2000 yds. long, under Cefn Onn, a direct line was provided from Caerphilly to Cardiff. A branch line, 4 m. long, was opened in 1894 to Senghenydd. The Pontypridd and Newport railway was constructed in 1887, and there is a joint station at Caerphilly for both railways. Some 2 m. eastwards there is a station on the Brecon and Merthyr railway at Bedwas.

The ancient commote of Senghenydd (corresponding to the modern hundred of Caerphilly) comprised the mountainous district extending from the ridge of Cefn Onn on the south to Breconshire on the north, being bounded by the rivers Taff and Rumney on the west and east. Its inhabitants, though nominally subject to the lords of Glamorgan since Fitzhamon's conquest, enjoyed a large measure of independence and often raided the lowlands. To keep these in check, Gilbert de Clare, during the closing years of the reign of Henry III., built the castle of Caerphilly on the southern edge of this district, in a wide plain between the two rivers. It had probably not been completed, though it was already defensible, when Prince Llewelyn ab Griffith, incensed by its construction and claiming its site as his own, laid siege to it in 1271 and refused to retire except on conditions. Subsequently completed and strengthened it became and still remains (in the words of G.T. Clark) "both the earliest and the most complete example in Britain of a concentric castle of the type known as 'Edwardian', the circle of walls and towers of the outer, inner and middle wards exhibiting the most complete illustration of the most scientific military architecture". The knoll on which it stood was converted almost into an island by the damming up of an adjacent brook, and the whole enclosed area amounted to 30 acres.

The great hall (which is 73 ft. by 35 ft. and about 30 ft. high) is a fine example of Decorated architecture. This and other additions are attributed to Hugh le Despenser (1318-1326). Edward II. visited the castle shortly before his capture in 1326. The defence of the castle was committed by Henry IV. to Constance, Lady Despenser, in September 1403, but it was shortly afterwards taken by Owen Glyndwr, to whose mining operations tradition ascribes the leaning position of a large circular tower, about 50 ft. high, the summit of which overhangs its base about 9 ft. Before the middle of the 15th century it had ceased to be a fortified residence and was used as a prison, which was also the case in the time of Leland (1535), who describes it as in a ruinous state. It is still, however, one of the most extensive and imposing ruins of the kind in the kingdom.

The town grew up around the castle but never received a charter or had a governing body. In 1661 the corporation of Cardiff complained of Cardiff's impoverishment by reason of a fair held every three weeks for the previous four years at Caerphilly, though "no Borough." Its markets during the 19th century had been chiefly noted for the Caerphilly cheese sold there. The district was one of the chief centres of the Methodist revival of the 18th century, the first synod of the Calvinistic Methodists being held in 1743 at Watford farm close to the town, from which place George Whitefield was married at Eglwysilan church two years previously. The church of St Martin was built in 1879, and there are Nonconformist chapels. Mining is now the chief industry of the district.

(D. Ll. T.)