Although there is evidence of scattered Brythonic settlements in the area, the first major settlement was founded by the Romans in 43 AD. This lasted for just seventeen years and around 61, the Iceni tribe led by Queen Boudica stormed it, burning it to the ground. The next, heavily planned incarnation of the city prospered and superseded Colchester as the capital of the Roman province of Britannia in 100. At its height during the 2nd century, Roman London had a population of around 60,000. By the 7th century, the Anglo-Saxons had created a new settlement called Lundenwic over a mile (2 km) upstream from the old Roman city, around what is now Covent Garden.

It is likely that there was a harbour at the mouth of the River Fleet for fishing and trading, and this trading grew, until the city was overcome by the Vikings and forced to move east, back to the location of the Roman Londinium, in order to use its walls for protection. Viking attacks continued to increase, until 886 when Alfred the Great recaptured London and made peace with the Danish leader, Guthrum. The original Saxon city of Lundenwic became Ealdwic ("old city"), a name surviving to the present day as Aldwych, which is in the modern City of Westminster.

Two recent discoveries indicate that London could be much older than previously thought. In 1999, the remains of a Bronze Age bridge were found on the foreshore north of Vauxhall Bridge. This bridge either crossed the Thames, or went to a (lost) island in the river. Dendrology dated the timbers to 1500BC.

In 2010, the foundations of a large timber structure, dated to 4500BC, were found on the Thames foreshore, South of Vauxhall Bridge. The function of the mesolithic structure is not known, but it covers at least 50m x 10m, and numerous 30 cm posts are visible at low tides. Both structures are on South Bank, at a natural crossing point where the River Effra flows into the River Thames, and 4 km upstream from the Roman City of London. The effort required to construct these structures implies trade, stability, and a community size of several hundred people at least.

With the collapse of Roman rule in the early 5th century, London was effectively abandoned. However, from the 6th century an Anglo-Saxon settlement known as Lundenwic developed slightly to the west of the old Roman city, around what is now Covent Garden and the Strand, rising to a likely population of 10–12,000. In the 9th century London was repeatedly attacked by Vikings, leading to a relocation of the city back to the location of Roman Londinium, in order to use its walls for protection. Following the unification of England in the 10th century London, already the country's largest city and most important trading centre, became increasingly important as a political centre, although it still faced competition from Winchester, the traditional centre of the kingdom of Wessex.

In the 11th century King Edward the Confessor re-founded and rebuilt Westminster Abbey and Westminster, a short distance upstream from London became a favoured royal residence. From this point onward Westminster steadily supplanted the City of London itself as a venue for the business of national government.

Following his victory in the Battle of Hastings, William, Duke of Normandy, was crowned King of England in the newly finished Westminster Abbey on Christmas Day 1066. William constructed the Tower of London, the first of the many Norman castles in England to be rebuilt in stone, in the southeastern corner of the city to intimidate the native inhabitants. In 1097, William II began the building of Westminster Hall, close by the abbey of the same name. The hall became the basis of a new Palace of Westminster. During the 12th century the institutions of central government, which had hitherto accompanied the royal court as it moved around the country, grew in size and sophistication and became increasingly fixed in one place. In most cases this was Westminster, although the royal treasury, having been moved from Winchester, came to rest in the Tower. While the City of Westminster developed into a true capital in governmental terms, its distinct neighbour, the City of London, remained England's largest city and principal commercial centre and flourished under its own unique administration, the Corporation of London. In 1100 its population was around 18,000; by 1300 it had grown to nearly 100,000. Disaster struck during the Black Death in the mid-14th century, when London lost nearly a third of its population London was the focus of the Peasants' Revolt in 1381.

During the Tudor period the Reformation produced a gradual shift to Protestantism, with much of London passing from church to private ownership. Mercantilism grew and monopoly trading companies such as the East India Company were established, with trade expanding to the New World. London became the principal North Sea port, with migrants arriving from England and abroad. The population rose from an estimated 50,000 in 1530 to about 225,000 in 1605.

In the 16th century William Shakespeare and his contemporaries lived in London at a time of hostility to the development of the theatre. By the end of the Tudor period in 1603, London was still very compact. There was an assassination attempt on James I in Westminster, through the Gunpowder Plot on 5 November 1605. London was plagued by disease in the early 17th century, culminating in the Great Plague of 1665–1666, which killed up to 100,000 people, or a fifth of the population. The Great Fire of London broke out in 1666 in Pudding Lane in the city and quickly swept through the wooden buildings. Rebuilding took over ten years and was supervised by Robert Hooke as Surveyor of London. In 1708 Christopher Wren's masterpiece, St Paul's Cathedral was completed. During the Georgian era new districts such as Mayfair were formed in the west; and new bridges over the Thames encouraged development in South London. In the east, the Port of London expanded downstream.

In 1762 George III acquired Buckingham House and it was enlarged over the next 75 years. During the 18th century, London was dogged by crime and the Bow Street Runners were established in 1750 as a professional police force. In total, more than 200 offenses were punishable by death, and women and children were hanged for petty theft. Over 74 per cent of children born in London died before they were five. The coffeehouse became a popular place to debate ideas, with growing literacy and the development of the printing press making news widely available; and Fleet Street became the centre of the British press.