How long? A recurring question, and a rather personal one (Lifeboat Sketch).
The real answer is: until the patient is cured, but we rarely have reliable criteria to help us decide when that occurs.
The kind of answer is either long enough so they don't relapse (eg UTI) or there is a need to cut out the infection for a cure (eg endocarditis).
Duration of antibiotics kind of depends on some vague combination of the virulence of the organism, the efficacy of the antibiotics, how robust the host immune system is and, likely most important, source control. Pseudomonas pneumonia in a dialysis patient sensitive only to colistin may need to be treated a bit longer than is standard. But how long? That's why we get MD/DO after the last name.
Others have thought deeply on the topic (PubMed), but in the end, it boils down to 10, because we have 10 fingers and multiples of 7, because we have seven days in a week. But not just any multiple, but 2,4 or 6 weeks. If we had 8 fingers and 11 day weeks, we would give antibiotics for 8 and 11 days.
And even if the recommendations and data suggest that 1 or 3 or 7 days is enough, antibiotic duration creeps to 10 to 15. Probably the best way to shorten antibiotic use is for every MD to lose a hand or for the week to become 4 days long.
That being said, there are antibiotic durations for some of the more common problems in the hospital, keeping in mind that not every patient may qualify.
See the individual entries for more details, remembering that you will see a variety of numbers suggest that offer different durations for different organisms.
From a nice editorial (PubMed)
Last Update: 10/31/19.