Caenorhabditis elegans uses ascaroside pheromones to induce development of the stress-resistant dauer larval stage and to coordinate various behaviors. Peroxisomal β-oxidation cycles are required for the biosynthesis of the fatty acid-derived side chains of the ascarosides. Here we show that three acyl-CoA oxidases, which catalyze the first step in these β-oxidation cycles, form different protein homo-and heterodimers with distinct substrate preferences. Mutations in the acyl-CoA oxidase genes acox-1, -2, and -3 led to specific defects in ascaroside production. When the acyl-CoA oxidases were expressed alone or in pairs and purified, the resulting acyl-CoA oxidase homo-and heterodimers displayed different sidechain length preferences in an in vitro activity assay. Specifically, an ACOX-1 homodimer controls the production of ascarosides with side chains with nine or fewer carbons, an ACOX-1/ACOX-3 heterodimer controls the production of those with side chains with seven or fewer carbons, and an ACOX-2 homodimer controls the production of those with ω-side chains with less than five carbons. Our results support a biosynthetic model in which β-oxidation enzymes act directly on the CoA-thioesters of ascaroside biosynthetic precursors. Furthermore, we identify environmental conditions, including high temperature and low food availability, that induce the expression of acox-2 and/or acox-3 and lead to corresponding changes in ascaroside production. Thus, our work uncovers an important mechanism by which C. elegans increases the production of the most potent dauer pheromones, those with the shortest side chains, under specific environmental conditions. dauer | pheromone | ascaroside | beta-oxidation | acyl-CoA oxidase