Short answer
Shaving the nape on its own while leaving the hair of the head long is disliked in the Hanafi texts, except for a need such as cupping (hijama). Tidying the stray hairs below your natural hairline after a haircut is ordinary grooming and is fine.
Al-Fatawa al-Hindiyya states that shaving the back of the neck (al-qafa) is makruh except for cupping. Cleaning up the neckline as part of a normal haircut is not what is meant.
The four schools agree on this.
Explanation
The Prophet ﷺ saw a boy with part of his head shaved and part left, and said: shave all of it or leave all of it. The Hanafi scholars disliked anything that leaves the head looking half shaved. In the same chapter, al-Fatawa al-Hindiyya says shaving the back of the neck is disliked unless it is done for hijama, where the cupping cups need bare skin.
What this means in practice. The disliked thing is shaving a bare patch up the back of the head and neck while the rest of the hair stays long, as some styles do. A barber who tidies the fluff below the hairline so the cut looks clean is not doing that; this is part of a normal haircut.
- Fine: a neat neckline, trimming stray neck hair, a haircut that takes the whole head short.
- Avoid: an undercut shaved high up the back while the top is long, or a shaved patch at the nape for style.
- For need: shaving the nape for hijama or a medical reason is allowed.
For fades, undercuts and other styles, see which haircuts are haram. For long hair, see is long hair sunnah for men.
The evidence
Sunan Abi Dawud 4195
Graded sahih... احلقوه كله أو اتركوه كله ...
"Shave all of it or leave all of it."
Said about a boy whose head was partly shaved; the basis for disliking half-shaved styles.
Where the ruling is recorded
- al-Fatawa al-Hindiyya, Kitab al-Karahiyya, chapter on circumcision, hair and nails. Shaving the back of the neck is disliked except for cupping.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.