Nifas is the bleeding a woman experiences following childbirth, and like menstruation it exempts her from prayer and fasting while it continues; scholars generally analogize its rulings to hayd, since the Sunnah addresses the broader category of menstrual-type bleeding (compare Quran 2:222). No verse fixes an exact length; the timeframe comes from juristic reasoning and the practice of women in the Prophet's ﷺ time. Most scholars fix a practical maximum. The Hanafi and Hanbali schools hold that nifas has a maximum of 40 days, since women were commonly told to wait roughly that long before resuming prayer. The Shafi'i and Maliki schools set the maximum at 60 days, while noting that 40 days is the most common (ghalib) duration in practice. If bleeding stops earlier, even after just a few days, a woman performs ghusl immediately and resumes prayer and fasting right away — there is no minimum duration. Bleeding that continues beyond a school's maximum (40 days for Hanafis/Hanbalis, 60 for Shafi'is/Malikis) is treated as istihadah rather than nifas, so she should perform ghusl and resume praying despite ongoing spotting.
Q&A · Purification
How long does nifas (postpartum bleeding) typically last, and when should a woman perform ghusl afterward?
Informational, not a personal fatwa. Consult a qualified scholar for rulings on your situation.