ModEM: a modular system for inversion of electromagnetic geophysical data. We describe implementation of a modular system of computer codes for inversion of electromagnetic geophysical data, referred to as ModEM. The system is constructed with a fine level of modular granularity, with basic components of the inversion – forward modeling, sensitivity computations, inversion search algorithms, model parametrization and regularization, data functionals – interchangeable, reusable and readily extensible. Modular sensitivity computations and generic interfaces to parallelized inversion algorithms provide a ready framework for rapid implementation of new applications or inversion algorithms. We illustrate the code׳s versatility and capabilities for code reuse through implementation of 3D magnetotelluric (MT) and controlled-source EM (CSEM) inversions, using essentially the same components.