The Cape Colony (Dutch: Kaapkolonie), also known as the Cape of Good Hope, was a British colony in present-day South Africa named after the Cape of Good Hope. It existed from 1795 to 1802, and again from 1806 to 1910, when it united with three other colonies to form the Union of South Africa, then became the Cape Province, which existed even after 1961, when South Africa had become a republic, albeit temporarily outside the Commonwealth of Nations (1961–94).
The British colony was preceded by an earlier corporate colony that became an original Dutch colony of the same name, which was established in 1652 by the Dutch East India Company (VOC). The Cape was under VOC rule from 1652 to 1795 and under rule of the Napoleonic Batavia Republic from 1803 to 1806. The VOC lost the colony to Great Britain following the 1795 Battle of Muizenberg, but it was ceded to the Batavia Republic following the 1802 Treaty of Amiens. It was re-occupied by the British following the Battle of Blaauwberg in 1806, and British possession affirmed with the Anglo-Dutch Treaty of 1814. The Cape of Good Hope then remained in the British Empire, becoming self-governing in 1872.