We investigated how the relative magnitude of colony and task differences in hydrocarbon (HC) profiles influences nest mate recognition in the harvester ant, Pogonomyrmex barbatus. We examined the HC profiles of 200 individuals from 4 task groups and 10 colonies and performed nest mate recognition assays between non-nest mates among task groups. HC profiles depend more on task group membership than on colony identity. Patrollers and foragers, that leave the nest mound and are most likely to encounter ants of other colonies, had the least variable HC profiles. Patrollers and foragers were most likely to be aggressive to non-nest mates. Thus low variation in HC profile is associated with a higher probability of aggression toward non-nest mates. There was no relationship between colony HC profiles and nest proximity. However, foragers were more aggressive toward ants from neighboring colonies than toward ants from more distant colonies. Our results suggest HCs are better predictors of task than colony and nest mate recognition depends on the task of workers in P. barbatus.