Demographics of KP
Historical population

Year Pop ±% p.a.
1951 4556545
1961 5730991 +2.32%
1972 8388551 +3.52%
1981 11061328 +3.12%
1998 17743645 +2.82%
2017 30523371 +2.90%

The province has an estimated population of about 30 million, according to 2017 estimates, that is an increase of 14.69% over 1998 figures, ranking Khyber Pakhtunkhwa over Islamabad, Punjab and Azad Kashmir in population gains during that period. The largest ethnic group is the Pashtun, who historically have been living in the areas for centuries. Around 1.5 million Afghan refugees also remain in the province, the majority of whom are Pashtuns followed by Tajiks, Hazaras, Gujjar and other smaller groups.
The Pashtuns of Khyber Pakhtunkhwa observe tribal code of conduct called Pakhtunwali which has four high value components called nang (honor), badal (revenge), melmastiya (hospitality) and nanawata (rights to refuge).
According to the 1998 census, the population of the province was approximately 17¾ million,of whom 52% were males and 48% were females.
Urdu, being the national and official language, serves as a lingua franca for inter-ethnic communications, and sometime Pashto and Urdu are the second and third languages among communities which speak other ethnic languages. In 2011 the provincial government approved in principle the introduction of the five regional languages of Pashto, Hindko, Saraiki, Khowar and Kohistani as compulsory subjects for the schools in the areas where they are spoken. There is some population in Peshawar city who speak Persian since nineteenth century; this population saw an increase during the 1980s and 1990s due to migration from Afghanistan.
The majority of the residents of the Khyber-Pakhtunkhwa overwhelmingly follows and professes the Sunni principles of Islam while the small followers of Shia principles of Islam are found among the Isma’ilis in the Chitral district. The tribe of Kalasha in southern Chitral still retain an ancient form of Hinduism mixed with Animism. There are very small numbers of residents who are the adherents of Roman Catholicism denomination of Christianity, Hinduism and Sikhism.