Porous electrode theory, pioneered by John Newman and collaborators, provides a macroscopic description of battery cycling behavior, rooted in microscopic physical models. Typically, the active materials are described as solid solution particles with transport and surface reactions driven by concentration fields, and the thermodynamics are incorporated through fitting of the open circuit potential. However, this approach does not apply to phase separating materials, for which the voltage is an emergent property of inhomogeneous concentration profiles, even in equilibrium. Here, we present a general framework, "multiphase porous electrode theory", based on nonequilibrium thermodynamics and implemented in an open-source software package called "MPET". Cahn-Hilliard-type phase field models are used to describe the active materials with suitably generalized models of interfacial reaction kinetics. Classical concentrated solution theory is implemented for the electrolyte phase, and Newman's porous electrode theory is recovered in the limit of solid solution active materials with Butler-Volmer kinetics. More general, quantum-mechanical models of faradaic reactions are also included, such as Marcus-Hush-Chidsey kinetics for electron transfer at electrodes, extended for concentrated solutions. The full model and implementation are described, and a variety of example calculations are presented to illustrate the novel features of the software compared to existing battery models. Lithium-based batteries have growing importance in global society 1 as a result of increased prevalence of portable electronic devices, 2 and their enabling role in the transition toward renewable energy sources.3 For example, lithium batteries can help mitigate intermittency of renewable energy sources such as solar power, and lithium battery powered electric vehicles are facilitating movement away from liquid fossil fuels for transportation. Each of these growing areas demands high performance batteries, with requirements specific to the particular needs of the application driving specialized battery design for sub-markets. Thus, it is critical that battery models be based on the underlying physics, enabling them to greatly facilitate cell design to take best advantage of the existing battery technologies.Lithium-ion batteries are generally constructed using two porous electrodes and a porous separator between them. The porous electrodes consist of various interpenetrating phases including electrolyte, active material, binder, and conductive additive. A schematic is shown in Figure 1. In a charged state, most of the lithium in the cell is contained in the active material within the negative electrode. During discharge, the lithium undergoes transport to the surface of the active material, electrochemical reaction to move from the active material to the electrolyte, transport through the electrolyte to the positive electrode, and reaction and transport to move into the active material of the positive electrode.4,5 Physical models must capture eac...