The term is from the Arabic root ḥ-n-f meaning "to incline, to decline" or "to turn or bend sideways" from the Syriac root of the same meaning. It is defined as "true believer, orthodox; one who scorns the false creeds surrounding him/her and profess the true religion" by The Arabic-English Dictionary of Modern Written Arabic.
According to Francis Edward Peters, in the verse 3:67 of the Quran it has been translated as "upright person" and outside the Quran as "to incline towards a right state or tendency". According to W. Montgomery Watt, it appears to have been used earlier by Jews and Christians in reference to "pagans" and applied to followers of an old Hellenized Syrian and Arabian religion and used to taunt early Muslims.
Michael Cook states "its exact sense is obscure" but the Quran "uses it in contexts suggestive of a pristine monotheism, which it tends to contrast with (latter-day) Judaism and Christianity". In the Quran hanif is associated "strongly with Abraham, but never with Moses or Jesus".
Oxford Islamic Studies online defines hanif as "one who is utterly upright in all of his or her affairs, as exemplified by the model of Abraham"; and that prior to the arrival of Islam "the term was used ... to designate pious people who accepted monotheism but did not join the Jewish or Christian communities."