{"Taking the model system of an oxide containing acceptor dopant cations and charge-compensating oxygen vacancies, we calculate at the continuum level the change in the excess grain-boundary energy of an ionic solid upon space-charge formation. Two different cases are considered for the space-charge layers: (i) only vacancies attain electrochemical equilibrium and (ii) both dopants and vacancies attain electrochemical equilibrium. The changes calculated for a specific set of grain boundaries indicate that, depending on dopant concentration, space-charged formation can decrease the excess free energy by up to 15% in the first case and by up to 45% in the second case. The possibility of the excess grain-boundary energy going to zero and the possible effects of an external electric field on the excess grain-boundary energy are also discussed.This article is part of the discussion meeting issue ‘Energy materials for a low carbon future’."}