Founded around 1000 AD, and established a "kaupstad" or trading place in 1048 by King Harald III, the city was elevated to a bishopric in 1070 and a capital under Haakon V around 1300. Personal unions with Denmark from 1397 to 1523 and again from 1536 to 1814 and with Sweden from 1814 to 1905 reduced its influence. After being destroyed by a fire in 1624, the city was moved closer to Akershus Castle during the reign of King Christian IV and renamed Christiania in his honour. It was established as a municipality (formannskapsdistrikt) on 1 January 1838. Following a spelling reform, it was known as Kristiania from 1877 to 1925, when its original Norwegian name was restored.
Oslo is the economic and governmental centre of Norway. The city is also a hub of Norwegian trade, banking, industry and shipping. It is an important centre for maritime industries and maritime trade in Europe. The city is home to many companies within the maritime sector, some of which are among the world's largest shipping companies, shipbrokers and maritime insurance brokers. Oslo is a pilot city of the Council of Europe and the European Commission intercultural cities programme.
Oslo is considered a global city and ranked "Beta World City" in studies performed by the Globalization and World Cities Study Group and Network in 2008. It was ranked number one in terms of quality of life among European large cities in the European Cities of the Future 2012 report by fDi magazine. A survey conducted by ECA International in 2011 placed Oslo as the second most expensive city in the world for living expenses after Tokyo. In 2013 Oslo tied with the Australian city of Melbourne as the fourth most expensive city in the world, according to the Economist Intelligence Unit (EIU)'s Worldwide Cost of Living study.
As of January 2014 the city of Oslo has a population of 634,000. The Metropolitan area of Oslo has a population of 1,502,604, of whom 951,581 live in the contiguous conurbation. The population currently increases at record rates, making it the fastest growing major city in Europe. This growth stems for the most part from international immigration and related high birth rates, but also from intra-national migration. The immigrant population in the city is growing somewhat faster than the Norwegian population, and in the city proper this is now more than 25% of the total.
According to the Norse sagas, Oslo was founded around 1049 by King Harald Hardråde. Recent archaeological research however has uncovered Christian burials which can be dated to prior to AD 1000, evidence of a preceding urban settlement. This called for the celebration of Oslo's millennium in 2000.
It has been regarded as the capital city since the reign of King Haakon V (1299–1319), the first king to reside permanently in the city. He also started the construction of the Akershus Castle. A century later, Norway was the weaker part in a personal union with Denmark, and Oslo's role was reduced to that of provincial administrative centre, with the monarchs residing in Copenhagen. The fact that the University of Oslo was founded as late as 1811 had an adverse effect on the development of the nation.
Oslo was destroyed several times by fire, and after the fourteenth calamity, in 1624, King Christian IV of Denmark and Norway ordered it rebuilt at a new site across the bay, near Akershus Castle and given the name Christiania. Long before this, Christiania had started to establish its stature as a centre of commerce and culture in Norway. The part of the city built starting in 1624 is now often called Kvadraturen because of its orthogonal layout. The last plague outbreak in Oslo occurred in 1654. In 1814 Christiania once more became a real capital when the union with Denmark was dissolved.
Many landmarks were built in the 19th century, including the Royal Palace (1825–1848); Stortinget (the Parliament) (1861–1866), the University, Nationaltheatret and the Stock Exchange. Among the world-famous artists who lived here during this period were Henrik Ibsen and Knut Hamsun (the latter was awarded the Nobel Prize for literature). In 1850, Christiania also overtook Bergen and became the most populous city in the country. In 1877 the city was renamed Kristiania. The original name of Oslo was restored in 1925.
On 25 July 1197 king Sverre and his soldiers attacked Oslo from Hovedøya.
During the Middle Ages, Oslo reached its heights in the reign of King Haakon V. He started the building of Akershus Castle and was also the first king to reside permanently in the city, which helped to make Oslo the capital of Norway.
In the end of the 12th century, Hanseatic traders from Rostock moved into the city and gained major influence in the city. The Black Death came to Norway in 1349 and, like other cities in Europe, the city suffered greatly. The churches' earnings from their land also dropped so much that the Hanseatic traders dominated the city's foreign trade in the 15th century.
Over the years, fire destroyed major parts of the city many times, as many of the city's buildings were built entirely of wood. After the last fire in 1624, which lasted for three days, King Christian IV decided that the old city should not be rebuilt again. His men built a network of roads in Akershagen near Akershus Castle. He demanded that all citizens should move their shops and workplaces to the newly built city of Christiania.
The transformation of the city went slowly for the first hundred years. Outside the city, near Vaterland and Grønland near Old Town, Oslo, a new, unmanaged part of the city grew up with citizens of low status.
In the 18th century, after the Great Northern War, the city's economy boomed with shipbuilding and trade. The strong economy transformed Christiania into a trading port.
In the 19th century, several state institutions were established and the city's role as a capital intensified. Christiania expanded its industry from 1840, most importantly around Akerselva. The expansion prompted the authorities to construct several important buildings, most of which remain as tourist attractions. There was a brief building boom from 1880, with many new houses, but the boom collapsed in 1889.
The municipality developed new areas such as The Horse (1918–1926) and Torshov (1917–1925). City Hall was constructed in the former slum area of Vika, from 1931–1950. The municipality of Aker was incorporated into Oslo in 1948, and suburbs were developed, such as Lambertseter (from 1951). Aker Brygge was constructed on the site of the former shipyard Akers Mekaniske Verksted, from 1982–1998.
In the 2011 Norway terror attacks, Oslo was hit by a bomb blast that ripped through the Government quarter, damaging several buildings including the building that houses the Office of the Prime Minister. Eight people were killed in the bomb attack.