We have developed a Bayesian methodology for inversion of controlled source electromagnetic (CSEM) data and magnetotelluric (MT) data. The inversion method provided optimal solutions and also the associated uncertainty for any sets of electric and magnetic components and frequencies from CSEM and MT data. The method is based on a 1D forward modeling method for the electromagnetic (EM) response for a plane-layered anisotropic earth model. The inversion method was also designed to invert common midpoint (CMP)-sorted data along a 2D earth profile assuming locally horizontal models in each CMP position. The inversion procedure simulates from the posterior distribution using a Markov chain Monte Carlo (McMC) approach based on the Metropolis-Hastings algorithm. The method that we use integrates available geologic prior knowledge with the information in the electromagnetic data such that the prior model stabilizes and constrains the inversion according to the described knowledge. The synthetic examples demonstrated that inclusion of more data generally improves the inversion results. Compared to inversion of the inline electric component only, inclusion of broadside and magnetic components and an extended set of frequency components moderately decreased the uncertainty of the inversion. The results were strongly dependent on the prior knowledge imposed by the prior distribution. The prior knowledge about the background resistivity model surrounding the target was highly important for a successful and reliable inversion result.