There is no precise answer. BUT…….. an appropriate antibiotic (from the macrolide family) such as azithromycin is believed to kill B. pertussis in 3 days. Anyone so treated can mix with others without risk of passing it on.
Otherwise it is over 3 weeks.
The research that best informs us of the answer was done in the 1920s and 1930s, not long after the causative organism was discovered in 1906.
Passing it on requires transmitting live organisms from the infected person to a non-infected person. It is not known how many live organisms are required. It is almost certain to depend on the susceptibility of the individual, which will probably involve many different factors. Previous immunization is an obvious one and age is another.
Even somebody very susceptible such as a newborn baby will probably need more than one live organism. Most healthy adults can only be infected by a dose of 100,000 colony forming units put into the nose (Preston, De Graff 2019). A colony forming unit is the smallest clump that can be produced and has a range content of individual cells.
So whether an infected person passes it on will depend on how many are coughed out and how many are breathed in. It is also very probable that transmission occurs via nasal or oral mucus or saliva, but how frequently this happens is unknown. It is believed that coughing is the main method. The organism cannot survive for long outside the body.
The simplest method for measuring live bacteria is by culturing them on a flat gel surface that supplies all the required nutrients for the organism.
The best method for Bordetella pertussis was found to be a ‘cough plate’. The gel medium in a flat dish was held about 15 centimetres from the subject’s mouth during a bout of coughing. After incubating it for at least 3 days the clumps of bacteria landing on the plate would continue to multiply thousands of times, eventually forming a colony visible to the naked eye and exhibiting physical characteristics that enabled the bacterial species to be identified.
This procedure allowed firstly a diagnosis to be made and secondly, if positive, a presumption of infectivity
Several independent investigators found out how long the organism could be detected for in the early years. Inevitably the findings were not exactly the same but they were fairly consistent.
The table is taken from Kendrick and Eldering’s 1933 paper. It is clear from this that some people are still coughing out live bacteria in week 6! And about a third are still doing it in week 5!
Unfortunately there is no agreement about when week 1 starts. Some investigators say when the illness starts, others when the cough starts. It is really difficult to know how much difference it made but it was probably 7 days or less.
How many bugs do you have to be coughing out before there is no risk of passing it on? Nobody knows. It will depend on the susceptibility of those in contact.
How many do you have to get into a body before it can take hold? Nobody knows. It will depend how susceptible you are.
How important are subclinical (ordinary cough and never diagnosed) cases in spreading it compared with clear cut cases? Nobody knows.
Can asymptomatically (no symptoms at all) infected people pass it on? Nobody knows.
Are people immunized with acellular vaccine more likely to pass it on than those given the older whole cell vaccine? Probably yes.
When very young babies with whooping cough are investigated for the source of their infection it can only be found in half. When a source is found it is usually the mother or siblings.
Cough plates went out of fashion because the skill needed to get a good one was difficult to acquire. One blob of spit would spoil the whole thing. Per-nasal swabs became standard. They were much more hit and miss but anyone could be easily taught to do them.
The information acquired from cough plates 90 years ago therefore still remains a kind of gold standard. Those investigations were, however, before the introduction of immunization which could easily modify the likelihood of transmission.
Modern detection depends on PCR which has given an enormous amount of useful information but it responds to dead bacteria and does not necessarily correlate with infectivity.
It all makes me wonder whether the official guideline that after 3 weeks there is no need for antibiotics is the best advice. We know that some people probably cough out live B. pertussis for up to 5 weeks. Even NICE is ambiguous. In its guidelines it refers to both 21 days since the start of the cough and 21 days since the start of symptoms when referring to the same groups of people. https://cks.nice.org.uk/whooping-cough#!topicSummary

Interesting
Myself and my 3 boys have been dealing with this illness for at least 7 weeks now. The 3 boys have taken antibiotics at different times, but my illness was less severe and I didn’t receive antibiotics. My oldest son had an allergic reaction to azithromycin as an infant and has never taken it since (he’s now 12yo). So the treating Dr. chose amoxicillin for him. Is that as effective, do you think that shortened his contagion time frame or not? His cough symptoms are by far the worst amongst our family. He is beyond 5 weeks and still coughs many times a day until he gags or throws up. This is the worst illness we’ve ever experienced. It seems to never end!
You have my sympathy. People don’t understand how bad it can be. Amoxicillin is ineffective. Co-trimoxazole is the alternative but it is unlikely to find any bugs to kill at this late 5 week stage and it would not help unless there was bad secondary infection.
I’m in week 11 of a whooping cough and have been logging my symptoms. All I wanted to know in the peak was how long I was going to feel terrified for.
My symptoms of whooping cough
4 days prior to initial tickle/cough commencing
Dizziness, nausea and low heart rate (resolved in 24 hours)
Week 1
Dry cough
Tiredness
Trouble sleeping
Out and about as normal
Week 2
Cough turned productive and persistent
Clearing of mucus
Vomiting from coughing
‘Whoop’ sound at end of cough
Loss of bladder control
Tiredness
Trouble sleeping (sleeping sitting up)
Prefer to stay home
Week 3 (commenced antibiotics and steroids)
Cough productive
Clearing of mucus
Vomiting from coughing
Fatigue
Dizziness
Trouble sleeping (15-30min at a time – sleeping sitting up)
Apnea
Larynx Spasm
Feeling of impending doom
Nausea
Anxiety
Loss of appetite
Cyanosis (looking grey)
Low heart rate
In bed
Week 4 (7 days after starting antibiotics)
Change in cough
Thickened mucus
Vomiting from coughing
Less frequent Larynx Spasm
Dry and full feeling in throat
Trouble sleeping (1 1/2 – 2 hours at a time – sleeping sitting up)
Fatigue
Shortness of breath
Staying home
Week 5
Fatigue
Improved sleeping (managing 3 hour block of sleep sitting up)
Shortness of breath
Dryer cough
Vomiting from coughing daily
Short hoop at end of cough
Swollen Lymph Nodes
Can manage being out of the house for 1 1/2 hours max.
Week 6
Phlegm reduced
Cough more dry and less frequent
Vomiting from coughing morning or evenings
Short hoop at end of consecutive cough
Fatigue reduced
Headaches
Cough Triggers – yawning, sneezing, physical activity
Improved sleep, waking 4 to 5 times a night (sleeping sitting up)
Back to work (from home)
Week 7
Dry cough
Vomiting from coughing every second day
Headaches
Short hoop at end of consecutive cough
Able to go about normal daily activities
Waking 4 to 5 times a night (still sleeping sitting up)
Not exercising yet
Week 8
Dry cough
Short hoop at end of consecutive cough
Minimal vomiting caused by cough
Improved sleep (once settled around midnight, can sleep aprox 4 hours, elevated sleeping)
Fatigue (normally in the mornings)
Not exercising yet
Week 9
Dry cough
Short hoop at end of consecutive cough
Improved sleep (once settled around midnight, can sleep aprox 4 hours, elevated sleeping)
Fatigue reduced
Minimal vomiting caused by cough (normally middle of night or morning 2 times this week)
Started daily walking
Week 10
Minimal coughing (Dry still with whoop)
Sleeping well (now laying almost flat)
Triggers – Laughter and drinking wine
No Fatigue
Week 11
Minimal coughing (Dry still with whoop)
Sleeping well (now laying almost flat)
Triggers – Laughter and drinking wine
Excellent account of real life impact of severe whooping cough. This will help people to understand this disease. It doesn’t attract public interest because the vast majority of people eventually recover from it.