Nifaas is the bleeding that occurs because of childbirth, whether the birth was natural or by Caesarean. In fact if a woman has a miscarriage and delivers a formed foetus - i.e., one in which features such as the head, arm or leg had appeared, which is only after eighty days of pregnancy - the bleeding that occurs because of that is also nifaas.
It says in Kashshaaf al-Qinaa (1/218): Nifaas is bleeding from the uterus that occurs at the time of birth, or two or three days before it, and after it up to 40 days. The ruling on nifaas is valid and applies even if the miscarriage occurred as a result of deliberate action such as the woman striking herself or taking medicine (to induce an abortion) and so onâ¦ if human features can be seen in the (foetus). But if she produces an alaqah (clot of blood) or a mudghah (unformed embryo resembling a piece of chewed flesh), then the rulings on nifaas do not apply. The minimum length of pregnancy at which human features may appear is eighty-one days, but in most cases, according to what was stated by al-Majd, Ibn Tameem, Ibn Hamdaan and others, is three months. End quote.
Nifaas may last for a few days then cease; there is no stipulation that it should continue for forty days.
And Allah knows best.
See also the answer to question no. 50308.
Reproduced from Islam QA