From the first years of the Byzantine Empire, Thessaloniki was considered the second city in the Empire after Constantinople,[40][41][42] both in terms of wealth and size.[40] with a population of 150,000 in the mid-12th century.[43] The city held this status until its transfer to Venetian control in 1423. In the 14th century, the city's population exceeded 100,000 to 150,000,[44][45][46] making it larger than London at the time.[47]
Fresco of 8th century in Hagios Demetrios. Entrace of the emperor, possibly Justinian II, in the city

During the 6th and 7th centuries, the area around Thessaloniki was invaded by Avars and Slavs, who unsuccessfully laid siege to the city several times, as narrated in the Miracles of Saint Demetrius.[48] Traditional historiography stipulates that many Slavs settled in the hinterland of Thessaloniki;[49] however, modern scholars consider this migration to have been on a much smaller scale than previously thought.[49][49][50] In the 9th century, the Byzantine Greek missionaries Cyril and Methodius, both natives of the city, created the first literary language of the Slavs, the Glagolic alphabet, most likely based on the Slavic dialect used in the hinterland of their hometown.[51][52][53][54][55]

An Arab naval attack in 904 resulted in the sack of the city.[56] The economic expansion of the city continued through the 12th century as the rule of the Komnenoi emperors expanded Byzantine control to the north. Thessaloniki passed out of Byzantine hands in 1204,[57] when Constantinople was captured by the forces of the Fourth Crusade and incorporated the city and its surrounding territories in the Kingdom of Thessalonica[58] — which then became the largest vassal of the Latin Empire. In 1224, the Kingdom of Thessalonica was overrun by the Despotate of Epirus, a remnant of the former Byzantine Empire, under Theodore Komnenos Doukas who crowned himself Emperor,[59] and the city became the capital of the short-lived Empire of Thessalonica.[59][60][61][62] Following his defeat at Klokotnitsa however in 1230,[59][63] the Empire of Thessalonica became a vassal state of the Second Bulgarian Empire until it was recovered again in 1246, this time by the Nicaean Empire.[59]