Vertebrate and insect olfactory systems generate diversity in odor perception using combinatorial coding, where individual odorant molecules activate unique but overlapping sets of olfactory receptor neurons. It is not well understood how these patterns are decoded and transformed into downstream physiological responses. Here, we demonstrate thatCaenorhabditis elegansuses combinatorial coding to formulate locomotory responses to the odorant 1-octanol (1-oct). Whole-network Ca++imaging showed that 1-oct is encoded combinatorially, activating multiple sensory neurons including ASH and AWC, associated with repulsion and attraction, respectively. The temporal dynamics of these neuronal activations indicate that 1-oct stimulates attractive and repulsive afferent pathways simultaneously; altering the relative strengths of these pathways is sufficient to convert 1-oct from a repellent to an attractant in microfluidics-based behavioral assays. These results identify the balance between attraction and repulsion as a key factor determining chemotactic behavior, achieved through modulation of locomotory reversals and speed. At the circuit level, the attractive and repulsive pathways can both entrain the activity of the reverse command interneuron AVA, a key regulator of reversals, with the stronger pathway predominating. This coding strategy facilitates context-dependent modulation of sensory responses. 1-oct is present in decaying plant material, signaling the possible presence of bacterial food. However, 1-oct is also toxic, and therefore represents a high risk food signal. Adding a different food signal (representing better food in a different location) suppresses the 1-oct attraction pathway by depressing AWC activity, tips the sensory balance toward the aversive pathway, and converts 1-oct attraction into 1-oct repulsion.