AbstractDespite the advantages of using biodegradable metals in implant design, their uncontrolled degradation and release remain a challenge in practical applications. A validated computational model of the degradation process can facilitate tuning implant biodegradation properties. In this study, a mathematical model of the chemistry of magnesium biodegradation was developed and implemented in a 3D computational model. The parameters were calibrated by Bayesian optimization using dedicated experimental data. The model was validated by comparing the predicted and experimentally obtained pH change in saline and buffered solutions, showing maximum 5% of difference, demonstrating the model's validity to be used for practical cases.