Primary C-fiber nociceptors are broadly divided into peptidergic and nonpeptidergic afferents. TRPV1 is a thermosensitive cation channel mainly localized in peptidergic nociceptors, whereas MrgD is a sensory G protein–coupled receptor expressed in most nonpeptidergic nociceptive afferents. TRPV1+ and MrgD+ fibers have been reported to be primarily involved in thermal and mechanical nociception, respectively. Yet, their functional assessment in somatosensory transmission relied on ablation strategies that do not account for compensatory mechanisms. To achieve selective activation of these 2 major subsets of C-fibers in vivo in adult mice, we used optogenetics to specifically deliver the excitatory opsin channelrhodopsin-2 (ChR2) to TRPV1+ or MrgD+ primary sensory neurons, as confirmed by histology and electrophysiology. This approach allowed, for the first time, the characterization of behavioral responses triggered by direct noninvasive activation of peptidergic TRPV1+ or nonpeptidergic MrgD+ fibers in freely moving mice. Transdermal blue light stimulation of the hind paws of transgenic mice expressing ChR2 in TRPV1+ neurons generated nocifensive behaviors consisting mainly of paw withdrawal and paw licking, whereas paw lifting occurrence was limited. Conversely, optical activation of cutaneous MrgD+ afferents produced mostly withdrawal and lifting. Of interest, in a conditioned place avoidance assay, blue light induced aversion in TRPV1-ChR2 mice, but not in MrgD-ChR2 mice. In short, we present novel somatosensory transgenic models in which control of specific subsets of peripheral unmyelinated nociceptors with distinct functions can be achieved with high spatiotemporal precision. These new tools will be instrumental in further clarifying the contribution of genetically identified C-fiber subtypes to chronic pain.