In the last few years, the combination of atomic-resolution Z-contrast microscopy, electron energy loss spectroscopy and first-principles theory has proved to be a powerful means for structure property correlations in complex materials1. Here we demonstrate the effectiveness of this combined approach by demonstrating the origins of electrical activity at grain boundaries in the prototypical perovskite SrTiO3 and the high-temperature superconductor YBa2Cu3O7-x, materials that are closely related in structure. We show, both experimentally and theoretically, that grain boundaries in SrTiO3 are intrinsically non-stoichiometric. Electron energy-loss spectroscopy (EELS) provides direct evidence of non-stoichiometry, in agreement with total- energy calculations that predict non-stoichiometric grain boundaries to be energetically favorable. The predicted structures are consistent with atomic-resolution Z-contrast micrographs. These results provide a consistent explanation of the grain boundary charge that was previously inferred from electrical measurements, and provides a microscopic explanation of the resulting “double-Schottky barriers”. We also present experimental evidence for non-stoichiometry at grain boundaries in the high-temperature superconductor YBa2Cu3O7-x, where the same phenomenon explains the observed exponential reduction of critical currents with grain boundary misorientation.