Ants are placed in a single family, the Formicidae. They belong to the order Hymenoptera, which includes bees, wasps, sawflies, and ichneumons.
A characteristic of most formicids is the possession of a metapleural gland. This gland produces phenylacetic acid, which fights against fungi and bacteria. It is made up of a pair of cell clusters which lead to two chambers in the rear of the ant's middle body. While the gland is the most diagnostic trait separating ants from other Hymenoptera, it is not universal among ants. Many arboreal species lack the metapleural gland (due perhaps to the drier, cleaner environment). Another trait that characterizes ants is their body structure. The ant head is connected by a thin neck to the thorax, which is then connected by a thin "waist" to the abdomen. While this is the general structure of many insects, ants are distinguished by the waist, which is pinched down posteriorly at its connection with the abdomen.