King Ram Khamhaeng (Thai: พ่อขุนรามคำแหง; RTGS: Pho Khun Ram Khamhaeng) was the third king of the Phra Ruang dynasty, ruling the Sukhothai Kingdom (a forerunner of the modern kingdom of Thailand) from 1279–1298, during its most prosperous era. He is credited with the creation of the Thai alphabet and the firm establishment of Theravada Buddhism as the state religion of the kingdom. Recent scholarship has cast doubt on his role, however, noting that much of the information relating to his rule may have been fabricated in the 19th century in order to legitimize the Siamese state in the face of colonial threats.
Historian Tri Amattayakun (Thai: ตรี อมาตยกุล) suggests that Ram Khamhaeng should have acceded to the throne in 1279, the year he planted a sugar palm tree in Sukhothai City. Prasoet Na Nakhon of the Royal Institute speculates that this was in a tradition of Thai-Ahom's monarchs, who planted banyan or sugar palm trees on their coronation day in the hope that their reign would achieve the same stature as the tree. The most significant event at the beginning of his reign, however, was the elopement of one of his daughters with the captain of the palace guards, a commoner who founded the Ramanya Kingdom and commissioned compilation of the Code of Wareru, which provided a basis for the law of Thailand used in Siam until 1908, and in Burma to the present.
According to the Chinese History of Yuan, King Ram Khamhaeng died by 1299 and was succeeded by his son, Loe Thai, though George Cœdès thinks it "more probable" it was "shortly before 1318". Legend states he disappeared in the rapids of the rivers of Sawankhalok.