Yes, cranberries contain compounds that can prevent bacteria from sticking to the walls of the urinary tract, reducing the risk of UTIs. However, it is important to note that cranberries are not a cure for UTIs and should not replace medical treatment.