Afḍal al-Dīn Muḥammad ibn Nāmāwar ibn ʿAbd al-Malik al-Khūnajī, best known as Afḍal al-Dīn Khūnajī (May 1194–December 1248), was a Persian scholar and a judge ("qadi") in Ayyubid Egypt. He is an important figure in the history of logic in the Arabic language. He appears to have hailed from the locality of Khunaj (a small town to the north of Zanjan) which had been destroyed in the 13th century during the Mongol invasion of Iran. 