Kannauj is the administrative headquarters of Kannauj District. The population was 71,530 in 2001, up from 58,932 in 1991. It has given its name to a distinct dialect of the Hindi language known as Kanauji.
Formerly known as Kanyakubja, the town is known to have been an important center during the Gupta empire. It was a centre of hindu culture and political status for centuries. Kannauj is frequently referred to in the epic Mahabharata and is alluded to by Patañjali in the second century B.C. In the year 405 A.D. when great Chinese pilgrim Fa-hien visited the city it had only two Buddhist monasteries and it was not very large. When Hiuen Tsang visited the city in 636 A.D., however, Kannauj had grown large. Hiuen Tsang stayed here for seven years.
Kannauj reached the pinnacle of its glory in the 7th century under emperor Harshavardhana (606-647 A.D.) Harshavardhana made Kannauj his capital. At that time it had earned the name of Mahodaya Sree due to its grandeur and prosperty. Kannauj then had a teeming population, with hundreds of Hindu and Buddhist temples and monasteries, extending along the east bank of the Ganges for about four miles. It had beautiful gardens and tanks, and was strongly fortified. Harshavardhana, however, was greatly weakened after being defeated by the Chalukya emperor Pulakesin II; his empire fell apart soon after his death.
By the end of the 8th century, Kannauj became the focus of a three-way contest by the three dominant dynasties of the time, the Pratiharas of Malwa, the Rashtrakutas of the Deccan, and the Palas of Bengal. The Pala king Dharmapala installed a proxy king at the end of the 8th century.
When the Pratihara king Nagabhata II conquered Kannauj in the 9th century Kannauj became the Pratihara capital for nearly 200 years. This happened about 836. During this period, it became known as a center for poetry. The Pratiharas ruled much of northern India in the latter half of the 8th century, but they had weakened by the early 10th century. The Rashtrakuta king Indra III captured Kannauj in 916, and by the end of that century, the Pratihara domains had been reduced to a small kingdom around the town of Kannauj.
In 1019, the town was sacked by Mahmud of Ghazni, beginning a chaotic period for the city. After this sacking of Kannauj, the area came to be dominated by the Chandela Rajput clan of Bundelkhand. The Gahadvala dynasty, descended from former vassals of the Pratiharas, established themselves as rulers of Kannauj at the end of the 11th century.