The best antibiotic to treat epididymitis depends on the underlying cause of the infection. For bacterial epididymitis caused by an STD, antibiotics such as doxycycline or azithromycin are often prescribed. If the infection is caused by a urinary tract infection, ciprofloxacin or levofloxacin may be used. The choice of antibiotic should be guided by the suspected or confirmed bacterial cause and tailored by a healthcare provider.