The brain transforms physical sensory stimuli into meaningful perceptions. In animals making choices about sensory stimuli, neuronal activity in successive cortical stages reflects a progression from sensation to decision. Feedforward and feedback pathways connecting cortical areas are critical for this transformation. However, the computational functions of these pathways are poorly understood because pathway-specific activity has rarely been monitored during a perceptual task. Using cellular-resolution, pathway-specific imaging, we measured neuronal activity across primary (S1) and secondary (S2) somatosensory cortices of mice performing a tactile detection task. S1 encoded the stimulus better than S2, while S2 activity more strongly reflected perceptual choice. S1 neurons projecting to S2 fed forward activity that predicted choice. Activity encoding touch and choice propagated in an S1-S2 loop along feedforward and feedback axons. Our results suggest that sensory inputs converge into a perceptual outcome as feedforward computations are reinforced in a feedback loop.