Channelrhodopsin2 (ChR2) optogenetic excitation is widely used to study neurons, astrocytes, and circuits. Using complementary approaches in situ and in vivo, we found that ChR2 stimulation leads to significant transient elevation of extracellular potassium ions by ∼5 mM. Such elevations were detected in ChR2-expressing mice, following local in vivo expression of ChR2(H134R) with adeno-associated viruses (AAVs), in different brain areas and when ChR2 was expressed in neurons or astrocytes. In particular, ChR2-mediated excitation of striatal astrocytes was sufficient to increase medium spiny neuron (MSN) excitability and immediate early gene expression. The effects on MSN excitability were recapitulated in silico with a computational MSN model and detected in vivo as increased action potential firing in awake, behaving mice. We show that transient, physiologically consequential increases in extracellular potassium ions accompany ChR2 optogenetic excitation. This coincidental effect may be important to consider during astrocyte studies employing ChR2 to interrogate neural circuits and animal behavior. Using multiple approaches, Octeau et al. discover that optogenetic excitation of ChR2-expressing cells leads to significant transient extracellular potassium ion elevations that increase neuronal excitability and immediate early gene expression in neurons following in vivo stimulation.