Before any fort, there was a market. The Guan people of the Fetu kingdom called it Oguaa, from their word for market, and the king of Fetu sent a chief to represent it as trade grew. Portuguese sailors named the spot Cabo Corso, short cape. The British wore that down to Cape Coast.
In 1650 the king of Fetu gave Hendrik Caerloff permission to build a fort on the cape. A timber lodge went up in 1653 under a Swedish company and was named Carolusborg. The Dutch occupied it after the king's death in 1663, and the English took it in 1664, strengthened it and renamed it Cape Coast Castle. In 1678 the English made the town the headquarters of the Royal African Company, and it became the capital of their holdings on this coast.
What drew them was gold dust. Local traders swapped it, along with mahogany and captives, for cloth and sugar, and the castle was where that bartering happened. Over time people became the main trade here, and the dungeons are thought to date from 1682 at the latest. The castle also handed out justice. In 1722 a court there condemned 54 sailors of the pirate Bartholomew Roberts, and 52 were hanged.
The 19th century was rough. The Asante invaded the coast in 1806. Fire burnt most of the town down in 1817, and the Asante threatened it again in 1824, once Charles MacCarthy's British troops had lost a battle. Even so, the British governed the Gold Coast from here from 1821 to 1877, and until Sekondi's harbour was built in the 1890s this was the busiest anchorage on the coast. The move of the capital to Accra in 1877 did lasting harm to the local economy. A gold rush in the 1880s gave it a small lift.
The 20th century made it a school town. Basel missionaries had been among the first to settle. St Francis Cathedral, dedicated in 1928, was the first Catholic cathedral in Ghana, and St Augustine's College opened in 1936. Cocoa brought some money, but once harbours and railways were finished at Sekondi and Kumasi, Cape Coast lost ground. Then came the Catholic archdiocese in 1950 and the university in 1962, and the town became the education centre it is now.
Heritage now pays part of the bills. A debt swap arranged for the region's tourism commission funded the restoration of the castles and forts, and it also led to the creation of Kakum National Park. Barack Obama came to the castle in July 2009 on his first presidential trip to sub-Saharan Africa, and Kamala Harris, then vice president, visited in March 2023. By 2021 the city had 189,925 people.