Light-gated chloride channels are emerging as promising optogenetic tools for inhibition of neural activity. However, their effects depend on the transmembrane chloride electrochemical gradient and may be complex due to the heterogeneity of this gradient in different developmental stages, neuronal types, and subcellular compartments. Here we characterized a light-gated chloride channel, GtACR2, in mouse cortical neurons. We found that GtACR2 activation inhibited the soma, but unexpectedly depolarized the presynaptic terminals resulting in neurotransmitter release. Other light-gated chloride channels had similar effects. Reducing the chloride concentrations in the axon and presynaptic terminals diminished the GtACR2-induced neurotransmitter release, indicating an excitatory effect of chloride channels in these compartments. A novel hybrid somatodendritic targeting motif reduced the GtACR2-induced neurotransmitter release while enhancing the somatic photocurrents. Our results highlight the necessity of precisely determining the effects of light-gated chloride channels under specific experimental conditions and provide a much-improved light-gated chloride channel for optogenetic inhibition.