Trimethoprim is an antibiotic used mainly in the treatment of bladder infections. Other uses include for middle ear infections and travelers' diarrhea. With sulfamethoxazole or dapsone it may be used for Pneumocystis pneumonia in people with HIV/AIDS. It is taken by mouth.