After the decline of the Khmer Empire and Kingdom of Pagan in the early-13th century, various states thrived in their place. The domains of Tai people existed from the northeast of present-day India to the north of present-day Laos and to the Malay peninsula. During the 13th century, Tai people had already settled in the core land of Dvaravati and Lavo Kingdom to Nakhon Si Thammarat in the south. There are, however, no records detailing the arrival of the Tais.
Around 1240, Pho Khun Bang Klang Hao, a local Tai ruler, rallied the people to rebel against the Khmer. He later crowned himself the first king of Sukhothai Kingdom in 1238. Mainstream Thai historians count Sukhothai as the first kingdom of Thai people. Sukhothai expanded furthest during the reign of Ram Khamhaeng (r. 1279–1298). However, it was mostly a network of local lords who swore fealty to Sukhothai, not directly controlled by it. He is believed have invented Thai script and Thai ceramics were an important export in his era. Sukhothai embraced Theravada Buddhism in the reign of Maha Thammaracha I (1347–1368).
To the north, Mangrai, who descended from a local ruler lineage of Ngoenyang, founded the kingdom of Lan Na in 1292, centered in Chiang Mai. He unified the surrounding area and his dynasty would rule the kingdom continuously for the next two centuries. He also created a network of states through political alliances to the east and north of the Mekong.:8 While in the port in Lower Chao Phraya Basin, a federation around Phetchaburi, Suphan Buri, Lopburi, and the Ayutthaya area was created in the 11th century.