Macrobid is the brand name for nitrofurantoin, an antibiotic used to treat or prevent urinary tract infections. Macrobid works by killing the bacteria that cause the infection or by preventing the bacteria from growing.