C. elegans has a highly developed chemosensory system that enables it to detect a wide variety of volatile (olfactory) and water-soluble (gustatory) cues associated with food, danger, or other animals. Much of its nervous system and more than 5% of its genes are devoted to the recognition of environmental chemicals. Chemosensory cues can elicit chemotaxis, rapid avoidance, changes in overall motility, and entry into and exit from the alternative dauer developmental stage. These behaviors are regulated primarily by the amphid chemosensory organs, which contain eleven pairs of chemosensory neurons. Each amphid sensory neuron expresses a specific set of candidate receptor genes and detects a characteristic set of attractants, repellents, or pheromones. About 500-1000 different G protein-coupled receptors (GPCRs) are expressed in chemosensory neurons, and these may be supplemented by alternative sensory pathways as well. Downstream of the GPCRs, two signal transduction systems are prominent in chemosensation, one that uses cGMP as a second messenger to open cGMP-gated channels, and one that relies upon TRPV channels. These sensory pathways are modulated and fine-tuned by kinases and phosphatases. Chemosensory preferences can be modified by sensory adaptation, developmental history, and associative learning, allowing C. elegans to integrate context and experience into its behavior.