No. Although they are both antibiotic pills, they are used to treat different things. They can both be used to treat the common urinary tract infections. Trimethoprim is a “sulfa” antibiotic and works by inhibiting DNA synthesis via a folic acid blocking mechanism. Nitrofurantoin works by blocking bacterial ribosomal function, which blocks their ability to grow.