- Published on
Dua for Nightmares: How the Prophet Taught Us to Handle Bad Dreams
- Authors

- Name
- Ahmad
- Role
- Senior Marketing Manager, Islamic education โข Deen Back
ุจูุณูู ู ุงูููู ุงูุฑููุญูู ูฐูู ุงูุฑููุญูููู ู
In the name of God, the Most Gracious, the Most Merciful.

You wake up suddenly. Heart pounding. A residue of something dark still present โ a feeling more than a memory. It was just a dream. You know that. But there is something unsettling about the experience that does not just disappear when you open your eyes.
The Prophet ๏ทบ understood this. He did not tell the Companions to ignore nightmares or to just go back to sleep. He gave them precise, actionable guidance โ specific physical actions and specific words โ rooted in the understanding that nightmares are real spiritual events that require a real spiritual response.
The Dua
The Prophet ๏ทบ taught a multi-part response to nightmares:
Step 1 โ Spit lightly to your left side three times:
Tuf โ a light, dry spit to the left, three times. This physical act of rejection is Sunnah and is part of the prescribed response. You are physically turning away from what disturbed you.
Step 2 โ Seek refuge from Shaytan:
ุฃูุนููุฐู ุจูุงูููููู ู ููู ุงูุดููููุทูุงูู ุงูุฑููุฌููู ู
A'udhu billahi minash-shaytanir-rajim.
"I seek refuge in Allah from the accursed Shaytan." โ (Sahih Muslim 2261)
Step 3 โ Change which side you are sleeping on
Roll to your other side. This physical change in position is part of the Sunnah response.
Step 4 โ If the nightmare is severe, get up and pray two rak'ahs
The Prophet ๏ทบ said: if the dream frightens you, get up and pray. (Sahih Muslim 2261)
When to use it: Immediately upon waking from a nightmare, while still in the moment of distress. The response is designed to be immediate โ physical action first (spit, seek refuge), then postural change, then optional prayer for severe cases.
The Prophet ๏ทบ said about this response: "It will not harm him" โ meaning the nightmare, if responded to correctly, has no power over you.
The Story Behind It
The narration in Sahih Muslim comes from Abu Qatadah (may Allah be pleased with him), who asked the Prophet ๏ทบ about dreams. The Prophet's answer was organized and clinical:
Good dreams are from Allah โ if you see one, praise Allah and tell those you love. Nightmares are from Shaytan โ if you see one, seek refuge from Shaytan, spit to your left three times, and do not tell anyone. It will not harm you.
What is striking is the Prophet's confidence in the prescription. He did not say "it might help" or "try this and see." He said: it will not harm you. This is prophetic certainty โ if you follow the Sunnah response, the nightmare has no lasting power over your waking state.
Another narration adds important context: the Prophet ๏ทบ said that Shaytan may appear in dreams in the form of something frightening or confusing โ and the response (seeking refuge) immediately removes his ability to continue affecting you. Sleep is described in several narrations as a period where the soul is partially returned to Allah. Shaytan tries to access that space. The protective duas and actions before sleep โ and the response after a nightmare โ are how you guard it.
The Prophet ๏ทบ himself was protected by Allah from Shaytan's influence, but he taught these practices for the rest of the ummah โ because the rest of us are not automatically protected, and we need these tools.
How to Make This Dua Part of Your Daily Life
The best response to nightmares starts before you go to sleep. Building a consistent evening Sunnah is the most effective long-term way to reduce nightmares and protect your sleep.
The preventive evening routine:
Perform wudu before sleeping โ Multiple narrations indicate that sleeping in a state of purity is protective. The Prophet ๏ทบ instructed his Companions to sleep in this state when possible.
Recite Ayat al-Kursi โ "Whoever recites it before sleeping will have a guardian from Allah, and no devil will come near him until morning" (Sahih al-Bukhari 5010). This is the single most important protective dua for sleep.
Recite the three Quls (Surah Al-Ikhlas, Al-Falaq, An-Nas) three times each โ The Prophet ๏ทบ did this every night without exception, wiping his hands over his body after reciting them.
Say the bedtime dua: Bismika Allahumma amutu wa ahya โ "In Your name, O Allah, I die and I live."
Sleep on your right side facing the qiblah if possible.
This routine is not magical โ it is the deliberate act of surrendering yourself to Allah's protection before sleep. When you do this consistently, the spiritual environment of your sleep changes.
When a nightmare happens:
Do not lie there replaying it. The prescribed response is immediate: spit lightly to the left, say A'udhu billahi minash-shaytanir-rajim, roll over, and if needed, get up and pray. Do not dwell on what you saw, do not analyze it, do not tell others about it. The Prophet ๏ทบ said not telling anyone is part of the protection.
Track your evening routine:
The connection between consistent evening adhkar and nightmare frequency is noticed by many Muslims who build this habit. Start tracking whether you completed your evening Sunnah before nights when you have disturbing dreams versus nights when you do not. The pattern tends to be clear.
Protect Your Sleep With the Evening Sunnah
Track your nightly Ayat al-Kursi, three Quls, and bedtime dua. DeenBack helps you build the consistent evening habits that guard your sleep from Shaytan's influence.
Free download. Premium features available in-app.
Related Duas
Dua for comprehensive protection at night:
ุงููููููู ูู ุฅููููู ุฃูุนููุฐู ุจููู ู ููู ุงููููู ูู ููุงููุญูุฒููู ููุงููุนูุฌูุฒู ููุงููููุณููู
"O Allah, I seek refuge in You from anxiety, sadness, weakness, and laziness." โ (Sahih al-Bukhari 6369)
When stress and anxiety are driving your nightmares, this dua addresses the root. For more on the anxious mind, see dua for anxiety.
For the full sleep protection routine:
The comprehensive protection duas for the evening are covered in dua for protection โ the Sunnah framework for building a spiritual shield around yourself and your household.
For connecting sleep to broader spiritual health:
Your nighttime is the bookend of your day. If anxiety about what happened or what is coming is disturbing your sleep, the dua for ease is worth building into your evening routine as well.
Common Questions
I woke from a nightmare but I am now fully awake and the moment has passed. Should I still say the dua?
Yes. Even if you are now fully awake and the immediate distress has faded, you can still say A'udhu billahi minash-shaytanir-rajim and make the dua for protection. The physical actions (spitting to the left, changing sides) are most effective in the immediate moment, but the verbal dua and seeking refuge remain valid and beneficial at any time.
My children have nightmares frequently. What should I do?
Teach your children the response: seek refuge in Allah from Shaytan, spit lightly to the left, and ask for a parent. Reciting the three Quls over your children before they sleep is a powerful protective practice. The Prophet ๏ทบ used to recite the three Quls and blow over Hasan and Husayn before they slept (Sunan al-Tirmidhi 3523). Doing this for your children is a Sunnah with specific prophetic precedent.
Are there nightmares that are actually warnings or significant?
The Prophet ๏ทบ taught that bad dreams are from Shaytan and should not be assigned significance or shared. This is the clear prophetic guidance. Assigning prophetic significance to nightmares opens a door to confusion, anxiety, and superstition that Islam consistently closes. Follow the Sunnah response and do not attempt to interpret bad dreams.
What if I cannot sleep after a nightmare?
Get up, make wudu, and pray two rak'ahs as the Prophet ๏ทบ recommended. Then read some Quran or engage in dhikr. Do not lie in bed replaying what you saw. Physical movement (getting up), ritual purification (wudu), and worship (prayer) redirect your mind, body, and spirit toward Allah rather than toward the disturbance. Many Muslims find that praying after a nightmare is one of the most peaceful prayers they experience.
Closing
Nightmares are not random. They are Shaytan's attempt to disturb you, to distress you, to leave you anxious and unsettled. The Prophet ๏ทบ knew this and gave you precise tools to neutralize it.
The response is not complex: seek refuge, spit to the left, change position, pray if needed. Do not replay it, do not share it, do not fear it. The Prophet ๏ทบ said: it will not harm you. Trust that. Act on it. And then build the evening routine that makes these incidents rare.
You are protected when you seek protection. That is the promise in the Sunnah.
Build the Evening Sunnah That Guards Your Night
Consistent Ayat al-Kursi, the three Quls, and bedtime dhikr are your spiritual armor. DeenBack helps you track and build the evening habits that protect your sleep every night.
Free download. Premium features available in-app.
Frequently Asked Questions
What is the dua for nightmares in Islam?
The Prophet (peace be upon him) taught a specific response to nightmares: spit lightly to your left side three times, say 'A'udhu billahi minash-shaytanir-rajim' (I seek refuge in Allah from the accursed Shaytan), change the side you are sleeping on, and get up and pray two rak'ahs if the nightmare is severe. He said the nightmare will not harm you if you do these things (Sahih Muslim 2261).
Are nightmares from Shaytan in Islam?
Yes. The Prophet (peace be upon him) explicitly said: 'A good dream is from Allah, and a bad dream (nightmare) is from Shaytan' (Sahih al-Bukhari 6984). This is not a metaphor โ nightmares are described as Shaytan's attempt to disturb, frighten, and distress the believer. The prescribed response is to seek refuge in Allah from Shaytan and not to dwell on the dream or let it affect you.
Should I tell someone about my nightmare?
The Prophet (peace be upon him) said: if you see a bad dream, do not tell anyone about it (Sahih Muslim 2261). Sharing a nightmare is discouraged in the Sunnah. You are not to analyze it, broadcast it, or let it concern you. The prescribed response is to seek refuge in Allah and move on. Dwelling on it or discussing it gives it more significance than it deserves.
Do I need to make wudu after a nightmare?
There is no obligation to perform wudu specifically because of a nightmare. However, the Prophet recommended getting up and praying two rak'ahs if a nightmare is severe (Sahih Muslim 2261). For this prayer, wudu would be necessary. More broadly, maintaining a habit of sleeping in a state of wudu reduces the frequency of disturbing dreams โ this is narrated in several traditions.
Why do I keep having the same nightmare?
Recurring nightmares can have both spiritual and psychological dimensions. From an Islamic perspective, ensure you are maintaining your evening adhkar and protective duas consistently โ Ayat al-Kursi, the three Quls, and the bedtime dua. If the nightmares persist despite consistent spiritual practice, there may be a psychological root โ stress, anxiety, unresolved emotional issues โ that may benefit from professional support alongside your dua practice.
