The Ghilji (Pashto: غلجي), also known as Khilji (Pashto: خلجي), Ghilzai (Pashto: غلزی), and Gharzai (Pashto: غرزی, ghar literally means "mountain" and zai "born of"), are the largest Pashtun tribal confederacy.
The Ghilji at various times became rulers of present Afghanistan region and were the most dominant Pashtun confederacy from c. 1000 A.D. until 1747 A.D., when power shifted to the Durranis. The Ghilji tribes are today scattered all over Afghanistan and some parts of Pakistan, but most are concentrated in the region from Zabul to Kabul province, with Ghazni and Paktika provinces in the center of their region.
The Ghilji tribes are also settled in Balochistan and Khyber Pakhtunkhwa in Pakistan. Many of the migrating Kochi people of Afghanistan belong to the Ghilji confederacy.
From 1709 to 1738, the Ghilji ruled the Hotak Empire based first in Kandahar, Afghanistan and later, from 1722–1728, in Isfahan, Persia.
Etymologically the word Ghilji is derived from ghar-zai (غرزی), meaning "son of mountain".
The most plausible theory suggests that the Ghilji descended from the Khalaj people, probably of Turkic origin, who early settled in the Siah-band range of the Ghor mountains, and first rose into the notice in the time of Mahmud of Ghazni, whom they accompanied in his invasions of India.