BayesMBAR is a Bayesian generalization of the multistate Bennett acceptance ratio (MBAR) method for estimating free energy differences between thermodynamic states. By integration of configurations sampled from thermodynamic states with a prior distribution, BayesMBAR computes a posterior distribution of free energies, from which free energy estimations and their associated uncertainties are obtained. Compared to MBAR, BayesMBAR provides more accurate uncertainty estimates and can incorporate prior knowledge into the estimation to improve the accuracy of the free energy estimates.