Electrical microstimulation can establish causal links between the activity of groups of neurons and perceptual and cognitive functions [1][2][3][4][5][6] . However, the number and identities of neurons microstimulated, as well as the number of action potentials evoked, are difficult to ascertain 7,8 . To address these issues we introduced the light-gated algal channel channelrhodopsin-2 (ChR2) 9 specifically into a small fraction of layer 2/3 neurons of the mouse primary somatosensory cortex. ChR2 photostimulation in vivo reliably generated stimulus-locked action potentials 10-13 at frequencies up to 50 Hz. Naïve mice readily learned to detect brief trains of action potentials (5 light pulses, 1ms, 20 Hz). After training, mice could detect a photostimulus firing a single action potential in approximately 300 neurons. Even fewer neurons (approximately 60) were required for longer stimuli (5 action potentials, 250 ms). Our results show that perceptual decisions and learning can be driven by extremely brief epochs of cortical activity in a sparse subset of supragranular cortical pyramidal neurons.We used in utero electroporation 14 to introduce ChR2 fused to a green fluorescent protein (ChR2-GFP 15 ) together with a red fluorescent cytosolic marker 15 (RFP) into neocortical pyramidal neurons (Fig. 1a, Methods). In the adult brain ChR2-GFP expression was restricted to pyramidal cells in layers 2/3 (> 99.4 %), mainly in the barrel cortex (Fig 1a, 2a). In vivo two-photon imaging and retrospective immunohistology revealed that ChR2-GFP was localized to the neuronal plasma membrane. ChR2-GFP was expressed in about half (48.9 ± 5.3 %, n = 10, 5 mice; see Methods) of red fluorescent layer 2/3 neurons (Supplementary Movie 1). ChR2-GFP invaded the soma, dendrites, and axons (Fig. 1b, 1c). ChR2-GFP expression was stable for at least 8 months and did not seem to perturb neuronal morphology (Fig. 1a-c, Methods).We next characterized the responses of ChR2-GFP-expressing neurons to photostimulation in anesthetized mice. To sample from the entire population of ChR2-GFP-expressing neurons, unbiased by ChR2-GFP expression level, we recorded from red fluorescent neurons using two-photon targeted loose-patch recordings 16 (Fig. 1c, d). Photostimuli consisted of light pulses, produced by a blue miniature light emitting diode (LED; 470 nm), centered on the recording window (Fig. 1d). At maximum light intensities (I max = 11.6 mW/mm 2 at the surface of the brain, centered on the diode; 1-10 ms duration) about half (51 %) of the patched red neurons (n = 39/77, 8 mice) responded reliably to single photostimuli with at AUTOR CONTRIBUTIONS DH and KS designed the experiments. DH performed the behavioral and in vivo physiological experiments. LP, DH and KS performed the brain slice measurements. NG performed histology. SR, TH, ZM, KS provided advice and equipment. DH and KS wrote the paper. All authors discussed the results and commented on the manuscript.