Tahajjud
Tahajjud is a voluntary night prayer offered after waking from sleep. The word means shaking sleep off. There is no fixed number of units, and the last third of the night is the best time for it. Sleeping first is what distinguishes it from other night prayers.
For the Ramadan congregation, see Taraweeh.
What the Word Means
The root behind tahajjud is an odd one. Hajada means to sleep - and it also means to stay awake through the night. One word, two opposite meanings. Arabic has a small class of these, and this is one of them.
Tahajjud is the form that means removing the thing: shaking off sleep, putting it away from yourself.
Which settles the definition before any ruling does. You cannot shake off something you never had. A prayer offered before going to bed is a night prayer, but it is not tahajjud. The sleeping is part of it.
The Verse It Comes From
The word appears once in the Qur'an, addressed to the Prophet ﷺ: and from part of the night, keep vigil with it as something additional for you; it may be that your Lord will raise you to a praised station (Qur'an 17:79).
Two things in that short verse are worth noticing.
It is described as additional - beyond what was required. Tahajjud was obligatory on the Prophet ﷺ and on the early community before the five daily prayers were established; afterwards it became voluntary for everyone else.
And the reward named is not forgiveness or paradise but a station - a position of praise. Something gained rather than something avoided.
Elsewhere the Qur'an describes those who keep it simply: their sides part from their beds, calling upon their Lord in fear and in hope (Qur'an 32:16).
The Last Third
The Prophet ﷺ said that our Lord descends each night to the lowest heaven when the last third of the night remains, saying: who is calling upon Me, that I may answer? Who is asking of Me, that I may give? Who is seeking My forgiveness, that I may forgive? (Sahih al-Bukhari 1145; Sahih Muslim 758).
That narration is the reason people set alarms for three in the morning, and it is why the last third is held to be the best part of the night rather than merely a permitted one.
It also shapes what tahajjud is for. The prayer is the occasion; the asking is the point. Someone who prays two units and then sits and talks to Allah about what is actually on their mind has understood it better than someone who prays twelve and goes back to bed.

The Three Knots
A practical narration, and a well-observed one.
The Prophet ﷺ said that when a person sleeps, Satan ties three knots at the back of their head, saying over each: the night is long, so sleep on. If they wake and remember Allah, one knot comes undone. If they perform ablution, another. If they pray, the third - and they rise cheerful and in good spirits. If not, they rise ill-tempered and sluggish (Sahih al-Bukhari 1142).
Anyone who has lain in bed arguing with themselves about getting up will recognise the description. The remedy given is a sequence of three small actions, each easier than the one that follows.
How Much, and When
When. Any time after Isha, once you have slept, until Fajr. The last third is best.
How many. No fixed number. Units are prayed in twos, and the night prayer is closed with witr, an odd number. The Prophet's ﷺ own practice is reported at eleven units including witr, and nothing obliges anyone to match it.
The minimum is two. Two units at three in the morning is tahajjud, properly and completely.
The pattern he described as most beloved to Allah was that of Dawud, who would sleep half the night, pray a third of it, and sleep a sixth (Sahih al-Bukhari 1131). A rhythm rather than an endurance feat.
Tahajjud, Qiyam al-Layl and Taraweeh
Three names that overlap, and the distinction is simple.
Qiyam al-layl means standing in the night - any voluntary prayer offered at night, whether or not you slept first. It is the widest term.
Tahajjud is qiyam al-layl offered after sleeping. The sleep is what makes it tahajjud.
Taraweeh is the qiyam of Ramadan, prayed in congregation early in the night.
So someone who prays taraweeh at the mosque, sleeps, and rises before Fajr to pray again has done both. The usual advice in that case is to pray witr with the imam and then offer additional units later without repeating witr.

Frequently Asked Questions
For it to be tahajjud, yes - that is what the word means. Praying voluntary units before bed is still qiyam al-layl and still rewarded; it is simply a different thing. If you find you cannot wake, praying before sleeping is far better than not praying at all.
As many as you can sustain, in twos, ending with witr. Two is a complete tahajjud. Scholars consistently advise against setting a number you will manage for a week and then abandon, since the Prophet ﷺ taught that the deeds most beloved to Allah are the consistent ones, even if small. Aisha, asked which of his deeds he loved most, answered: the one done regularly.
Then pray what you can during the day instead. The Prophet ﷺ advised someone who missed their night portion through sleep or illness to pray twelve units between sunrise and midday, and said the reward would be recorded for them. Nobody is being penalised for needing sleep.
No, though they overlap. Taraweeh is prayed in congregation early in the night during Ramadan. Tahajjud is prayed after sleeping, at any time of year, usually alone. Both are qiyam al-layl, and someone can do both in one night.
Whatever you know. There is no set recitation. Lengthening the standing is recommended where you can manage it, and the night is the one time most people can pray slowly without anyone waiting. If you have memorised little, short surahs repeated are entirely sufficient.

The Three Knots
A practical narration, and a well-observed one.
The Prophet ﷺ said that when a person sleeps, Satan ties three knots at the back of their head, saying over each: the night is long, so sleep on. If they wake and remember Allah, one knot comes undone. If they perform ablution, another. If they pray, the third - and they rise cheerful and in good spirits. If not, they rise ill-tempered and sluggish (Sahih al-Bukhari 1142).
Anyone who has lain in bed arguing with themselves about getting up will recognise the description. The remedy given is a sequence of three small actions, each easier than the one that follows.
When. Any time after Isha, once you have slept, until Fajr. The last third is best.
How many. No fixed number. Units are prayed in twos, and the night prayer is closed with witr, an odd number. The Prophet's ﷺ own practice is reported at eleven units including witr, and nothing obliges anyone to match it.
The minimum is two. Two units at three in the morning is tahajjud, properly and completely.
The pattern he described as most beloved to Allah was that of Dawud, who would sleep half the night, pray a third of it, and sleep a sixth (Sahih al-Bukhari 1131). A rhythm rather than an endurance feat.
Three names that overlap, and the distinction is simple.
Qiyam al-layl means standing in the night - any voluntary prayer offered at night, whether or not you slept first. It is the widest term.
Tahajjud is qiyam al-layl offered after sleeping. The sleep is what makes it tahajjud.
Taraweeh is the qiyam of Ramadan, prayed in congregation early in the night.
So someone who prays taraweeh at the mosque, sleeps, and rises before Fajr to pray again has done both. The usual advice in that case is to pray witr with the imam and then offer additional units later without repeating witr.

Frequently Asked Questions
For it to be tahajjud, yes - that is what the word means. Praying voluntary units before bed is still qiyam al-layl and still rewarded; it is simply a different thing. If you find you cannot wake, praying before sleeping is far better than not praying at all.
As many as you can sustain, in twos, ending with witr. Two is a complete tahajjud. Scholars consistently advise against setting a number you will manage for a week and then abandon, since the Prophet ﷺ taught that the deeds most beloved to Allah are the consistent ones, even if small. Aisha, asked which of his deeds he loved most, answered: the one done regularly.
Then pray what you can during the day instead. The Prophet ﷺ advised someone who missed their night portion through sleep or illness to pray twelve units between sunrise and midday, and said the reward would be recorded for them. Nobody is being penalised for needing sleep.
No, though they overlap. Taraweeh is prayed in congregation early in the night during Ramadan. Tahajjud is prayed after sleeping, at any time of year, usually alone. Both are qiyam al-layl, and someone can do both in one night.
Whatever you know. There is no set recitation. Lengthening the standing is recommended where you can manage it, and the night is the one time most people can pray slowly without anyone waiting. If you have memorised little, short surahs repeated are entirely sufficient.