Yes. The antibiotics used to treat mastitis are absolutely compatible with breastfeeding.
Antibiotics (either by mouth or via an IV if you are very sick) may be needed if you are diagnosed with mastitis and it does not improve with initial supportive measures (like rest and hydration) in 12-24 hours or if you are very ill when it starts. There are a few options that are perfectly safe with breastfeeding.
The most common cause of mastitis is S. aureus, a common skin bacteria. The good news is that certain types of penicillins are all that is needed to kill it, but alternatives exist if you have a penicillin allergy or there is a concern that it may be resistant to the penicillin family. Most regimens involve taking the medicine for 10-14 days.
If your doctor or midwife recommends an antibiotic, please take it, and be sure to take the entire course even if you start to see improvements sooner! Incompletely treated mastitis will only prolong the healing process and make complications such as a breast abscess or low milk supply more likely.
Reviewed by Sara Connolly, March 2020