Short answer
Yes. The Prophet ﷺ ordered killing snakes, especially dangerous kinds. For a snake found inside a house, he taught first warning it to leave three times (some scholars say over three days), because some may be jinn, unless it is about to harm you. Keeping a venomous snake as a pet is not allowed; scholars differ on harmless pet snakes.
Killing snakes is permitted, and killing dangerous ones is encouraged. Warning a house snake before killing it is better, following the hadith, unless there is immediate danger.
The four schools agree on this.
Explanation
The Prophet ﷺ said: kill snakes, and kill the one with two white stripes and the short-tailed one, because they blind the eyes and cause miscarriage. Snakes were a real danger in Madinah, as they are in many places today, and protecting life comes first.
He also said that these houses have dwellers, meaning jinn, so if you see one of them, warn it three times, and if it stays after that, kill it. This hadith came after a young Companion killed a snake in his house and died soon after. From it scholars take that a snake found living inside a home should be told to leave first, for example by saying 'I ask you by Allah to leave and not harm us', and killed if it remains. Scholars differ on whether the warning applies to all houses or mainly to Madinah. Snakes outside houses, and any snake about to strike, may be killed straight away.
Practical points:
- Call professionals where they exist; many countries protect certain species by law, and you should follow that law.
- Kill quickly; do not torture or burn.
- A harmless garden snake does not need to be hunted down.
Pet snakes: keeping a venomous snake is not allowed, since it puts lives at risk. For non-venomous pet snakes, contemporary scholars differ: some allow them with secure housing and proper care, others discourage keeping an animal the sunnah tells us to kill. Feeding them live animals raises welfare concerns too. Ask a scholar before getting one.
For snakes in dreams, see snakes in dreams, and for jinn, Jinn in Islam.
The evidence
Sahih al-Bukhari 3297
Sahih... اقتلوا الحيات واقتلوا ذا الطفيتين والأبتر ...
"Kill snakes, and kill the one with two stripes and the short-tailed one."
Killing dangerous snakes is commanded.
Sahih Muslim 2236
Sahih... إن لهذه البيوت عوامر فإذا رأيتم شيئا منها فحرجوا عليها ثلاثا ...
"These houses have dwellers, so if you see one of them, warn it three times."
House snakes should be warned before being killed.
Where the ruling is recorded
- Sharh Sahih Muslim (al-Nawawi), Kitab al-Salam, chapter on killing snakes and the like. Discusses warning house snakes and whether this applies beyond Madinah.
- al-Hidaya, Kitab al-Hajj, chapter on violations (jinayat). Snakes are among the harmful creatures a pilgrim may kill.
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.