It's best to take metformin with a meal to reduce the side effects.
The most common side effects are feeling and being sick, diarrhoea, stomach ache and going off your food.
Yet, I just came across Hashimoto, et al (2016) who states that,
Taking metformin with a meal has been shown to decrease bioavailability of metformin. We hypothesized that taking metformin 30 min before a meal improves glucose metabolism.
Taking metformin 30 min before a meal ameliorated postprandial hyperglycemia. This promises to be a novel approach for postprandial hyperglycemia.
So, has Hashimoto's team proved that normal advice is wrong and Metformin should be taken 30 minutes before a meal?
Hashimoto, Y., Tanaka, M., Okada, H., Mistuhashi, K., Kimura, T., Kitagawa, N., Fukuda, T., Majima, S., Fukuda, Y., Tanaka, Y., Yamada, S., Senmaru, T., Hamaguchi, M., Asano, M., Yamazaki, M., Oda, Y., Hasegawa, G., Nakamura, N., & Fukui, M. (2016). Postprandial hyperglycemia was ameliorated by taking metformin 30 min before a meal than taking metformin with a meal; a randomized, open-label, crossover pilot study. Endocrine, 52(2), 271–276. https://doi.org/10.1007/s12020-015-0786-4