Denmark has been inhabited by various Germanic peoples since ancient times, including the Angles, Cimbri, Jutes, Herules, Teutones and others. The first mentions of "Danes" are recorded in the mid-6th century by historians Procopius (Greek: δάνοι) and Jordanes (danī), who both refer to a tribe related to the Suetidi inhabiting the peninsula of Jutland, the province of Scania and the isles in between. Frankish annalists of the 8th century often refer to Danish kings. The Bobbio Orosius from the early 7th century distinguishes between South Danes inhabiting Jutland and North Danes inhabiting the isles and the province of Scania.
The first mention of Danes within the Denmark is on the Jelling Rune Stone, which mentions the conversion of the Danes to Christianity by Harald Bluetooth in the 10th century. Between c. 960 and the early 980s, Bluetooth established a kingdom in the lands of the Danes, stretching from Jutland to Scania. Around the same time, he received a visit from a German missionary who, by surviving an ordeal by fire according to legend, convinced Harold to convert to Christianity.
The following years saw the Danish Viking expansion, which incorporated Norway and Northern England into the Danish North Sea Empire. After the death of Canute the Great in 1035, England broke away from Danish control. Canute's nephew Sweyn Estridson (1020–74) re-established strong royal Danish authority and built a good relationship with the archbishop of Bremen, at that time the archbishop of all Scandinavia. Over the next centuries, the Danish empire expanded throughout the southern Baltic coast. Under the 14th century king Olaf II, Denmark acquired control of the Kingdom of Norway, which included the territories of Norway, Iceland and the Faroese Islands. Olaf's mother united Norway, Sweden and Denmark into the Kalmar Union.
In 1523, Sweden won its independence, leading to the dismantling of the Kalmar Union and the establishment of Denmark-Norway. Denmark-Norway grew wealthy during the 16th century, largely because of the increased traffic through the Øresund. The Crown of Denmark could tax the traffic, because it controlled both sides of the Sound at the time.
The Reformation, which originated in the German lands in the early 16th century from the ideas of Martin Luther (1483–1546), had a considerable impact on Denmark. The Danish Reformation started in the mid-1520s. Some Danes wanted access to the Bible in their own language. In 1524, Hans Mikkelsen and Christiern Pedersen translated the New Testament into Danish; it became an instant best-seller. Those who had traveled to Wittenberg in Saxony and come under the influence of the teachings of Luther and his associates included Hans Tausen, a Danish monk in the Order of St John Hospitallers.
In the 17th century Denmark-Norway colonized Greenland.
After a failed war with the Swedish Empire, the Treaty of Roskilde in 1658 removed the areas of the Scandinavian peninsula from Danish control, thus establishing the boundaries between Norway, Denmark, and Sweden that exist to this day. In the centuries after this loss of territory, the populations of the Scanian lands, who had previously been considered Danish, came to be fully integrated as Swedes.
In the early 19th century, Denmark suffered a defeat in the Napoleonic Wars; Denmark lost control over Norway and territories in what is now northern Germany. The political and economic defeat ironically sparked what is known as the Danish Golden Age during which a Danish national identity first came to be fully formed. The Danish liberal and national movements gained momentum in the 1830s, and after the European revolutions of 1848 Denmark became a constitutional monarchy on 5 June 1849. The growing bourgeoisie had demanded a share in government, and in an attempt to avert the sort of bloody revolution occurring elsewhere in Europe, Frederick VII gave in to the demands of the citizens. A new constitution emerged, separating the powers and granting the franchise to all adult males, as well as freedom of the press, religion, and association. The king became head of the executive branch.