Erythromycin is used to treat a wide variety of bacterial infections. It may also be used to prevent certain bacterial infections. Erythromycin is known as a macrolide antibiotic. It works by stopping the growth of bacteria. This antibiotic treats or prevents only bacterial infections. It will not work for viral infections (such as common cold, flu). Unnecessary use or misuse of any antibiotic can lead to its decreased effectiveness.