Here we report direct evidence that cuticular hydrocarbons are responsible for nestmate recognition in Formica japonica distributing in Southern Honshu in Japan. Workers showed aggressive behavior against foreign workers but not against nestmates. A similar response was observed when a glass dummy was treated with isolated hydrocarbons from foreign workers or nestmates. Among the isolated hydrocarbons, ten hydrocarbon components were identified: five nalkanes and five (Z)-9-alkenes with odd number of carbons from 25 to 33, in different ratios in different colonies. When synthetic hydrocarbons blended in the same ratio as natural blends were presented to workers, they showed aggressive responses against foreign blends but paid less attention to those of nestmates. Neither n-alkane nor (Z)-9-alkene blends, however, caused aggression response in foreign workers. Thus, both n-alkanes and (Z)-9-alkenes are necessary to discriminate nestmates from foreign conspecifics.