Ranitidine does not have to be taken with, before, or after food. However, when taken 30-60 minutes before food, it can help prevent the symptoms of heartburn associated with eating.