The nematode Caenorhabditis elegans produces a broad family of pheromones, known as the ascarosides, that are modified with a variety of groups derived from primary metabolism. These modifications are essential for the diverse activities of the ascarosides in development and various behaviors, including attraction, aggregation, avoidance, and foraging. The mechanism by which these different groups are added to the ascarosides is poorly understood. Here, we identify a family of over 30 carboxylesterase domain-containing (CEST) enzymes, which are homologous to mammalian carboxylesterase and acetylcholinesterase enzymes, and show that a number of these enzymes are responsible for the selective addition of specific modifications to the ascarosides. Analysis of ascaroside production in
cest-3,
cest-9.2, and
cest-8 mutant strains shows that they specifically do not produce indole-3-carbonyl (IC)-modified (i.e., icas), (E)-2-methyl-2-butenoyl (MB)-modified (i.e., mbas), octopamine succinyl (OS)-modified (i.e., osas) ascarosides, respectively. These defects can be rescued through cest overexpression. Furthermore, a
cest-3[S208A] strain in which the Ser residue in the catalytic triad of CEST-3 was mutated to an Ala residue does not produce the IC-ascarosides. This strain is also less likely to localize to a lawn of bacterial food than wild type. This result is consistent with the role of the IC-ascarosides in promoting attraction, promoting aggregation on food, and suppressing foraging. Through stable isotope-labeled ascaroside feeding experiments, we demonstrate the in vivo activity of the CEST enzymes and provide direct evidence that the acyl-CoA synthetase ACS-7, which was previously implicated in the attachment of certain modifications to the ascarosides in C. elegans, instead activates the side chains of certain ascarosides for shortening through beta-oxidation. Our data provide a key to the combinatorial logic that gives rise to different modified ascarosides, which should greatly facilitate the exploration of the specific biological functions of these pheromones in the worm.