Cognitive impairment is common in extracerebral diseases such as chronic kidney disease (CKD). Kidney transplantation reverses cognitive impairment, indicating that cognitive impairment driven by CKD is therapeutically amendable. However, we lack mechanistic insights allowing development of targeted therapies. Using a combination of mouse models (including mice with neuron-specific IL-1R1 deficiency), single cell analyses (single-nuclei RNA-sequencing and single-cell thallium autometallography), human samples and in vitro experiments we demonstrate that microglia activation impairs neuronal potassium homeostasis and cognition in CKD.