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