The haplodiploid sex determining system in Hymenoptera, whereby males develop from haploid eggs and females from diploid eggs, allows females to control the primary sex ratio (the proportion of each sex at oviposition) in response to ecological and/or genetic conditions. Surprisingly, primary sex ratio adjustment by queens in eusocial Hymenoptera has been poorly studied, because of difficulties in sexing the eggs laid. Here, we show that fluorescence in situ hybridization (FISH) can be used to accurately determine the sex (haploid or diploid) of eggs, and hence the primary sex ratio, in ants. We first isolated the homologue coding sequences of the abdominal-A gene from 10 species of 8 subfamilies of Formicidae. Our data show that the nucleotide sequence of this gene is highly conserved among the different subfamilies. Second, we used a sequence of 4.5 kbp from this gene as a DNA probe for primary sex ratio determination by FISH. Our results show that this DNA probe hybridizes successfully with its complementary DNA sequence in all ant species tested, and allows reliable determination of the sex of eggs. Our proposed method should greatly facilitate empirical tests of primary sex ratio in ants.