The British Empire comprised the dominions, colonies, protectorates, mandates and other territories ruled or administered by the United Kingdom. It originated with the overseas colonies and trading posts established by England in the late 16th and early 17th centuries. At its height it was the largest empire in history and, for over a century, was the foremost global power. By 1922 the British Empire held sway over about 458 million people, one-quarter of the world's population at the time, and covered more than 33,700,000 km2 (13,012,000 sq mi), almost a quarter of the Earth's total land area. As a result, its political, linguistic and cultural legacy is widespread. At the peak of its power, it was often said that "the sun never sets on the British Empire" because its span across the globe ensured that the sun was always shining on at least one of its numerous territories.
During the Age of Discovery in the 15th and 16th centuries, Portugal and Spain pioneered European exploration of the globe, and in the process established large overseas empires. Envious of the great wealth these empires bestowed, England, France and the Netherlands began to establish colonies and trade networks of their own in the Americas and Asia. A series of wars in the 17th and 18th centuries with the Netherlands and France left England (Britain, following the 1707 Act of Union with Scotland) the dominant colonial power in North America and India. The loss of the Thirteen Colonies in North America in 1783 after a war of independence deprived Britain of some of its oldest and most populous colonies. British attention soon turned towards Africa, Asia and the Pacific. Following the defeat of Napoleonic France in 1815, Britain enjoyed a century of almost unchallenged dominance, and expanded its imperial holdings across the globe. Increasing degrees of autonomy were granted to its white settler colonies, some of which were reclassified as dominions.
The growth of Germany and the United States had eroded Britain's economic lead by the end of the 19th century. Subsequent military and economic tensions between Britain and Germany were major causes of the First World War, during which Britain relied heavily upon its Empire. The conflict placed enormous financial strain on Britain, and although the Empire achieved its largest territorial extent immediately after the war, it was no longer a peerless industrial or military power. The Second World War saw Britain's colonies in South-East Asia occupied by Japan, which damaged British prestige and accelerated the decline of the Empire, despite the eventual victory of Britain and its allies. India, Britain's most valuable and populous possession, was granted independence within two years of the end of the war.
After the end of the Second World War, as part of a larger decolonisation movement by European powers, most of the territories of the British Empire were granted independence, ending with the handover of Hong Kong to the People's Republic of China in 1997. Fourteen territories remain under British sovereignty, the British overseas territories. After independence, many former British colonies joined the Commonwealth of Nations, a free association of independent states. Sixteen Commonwealth nations share their head of state, Queen Elizabeth II, as Commonwealth realms.