The only Anglo-Saxon kingdom to survive the Viking invasions of the late 9th century intact. Wessex, the kingdom of the West Saxons, is traditionally considered to have been founded by Cerdic c AD 500, and by the 9th century it covered most of England south of the River Thames. Its main towns were Winchester and Hamwic (Southampton). The victory of Egbert (r. 802-839) over the rival kingdom of Mercia at Ellandun in 825 established Wessex as the strongest Anglo-Saxon kingdom, and in 829 he was recognised as Bretwalda (high king of Britain). Viking attacks on Wessex began during the reign of Egbert's predecessor Beorhtric (r. 786-802) with a raid on Portland, probably in 789. Later tradition in Wessex held that this was the first Viking raid in Britain. Large-scale Viking attacks began only in 836 when Egbert was defeated by thirty-five ships' companies at Carhampton in Somerset. The scale of raids escalated dramatically in the 850s when the Vikings wintered at Thanet in the Thames Estuary, but generally the West Saxons gave the Vikings as good as they got.
With the arrival of the Danish great army in East Anglia in 865 the Viking threat escalated yet again, but its first foray into Wessex five years later was defeated by king Aethelred and his brother Alfred after bitter fighting. The Danes under Guthrum, Oscetel and Anund, invaded again in 875 and Alfred, now king (r. 871-899), was hard pressed, driving them out only after his decisive victory at Edington in 878. Alfred successfully defended his kingdom against a second Viking onslaught in 892-6.
Alfred was followed by a succession of able kings who progressively brought the rest of England under their control. Alfred's son Edward the Elder worked closely with his sister Aethelflaed, wife of the Mercian earldoman Aethelred, to conquer the Danelaw of eastern England in 912-18. A year after Aethelflaed's death in 918, Edward annexed Mercia, taking West Saxon control to the Humber and the Mercy. When Edward's son Athelstan captured York from the Norse in 927, all the Anglo-Saxons and all the Scandinavian settlers in England came under a single ruler for the first time and Wessex was transformed into the kingdom of England.
Notes from Encyclopaedia of the Viking Age by John Haywood. Thames & Hudson 2000. p 208.