Flies are adapted for aerial movement and typically have short and streamlined bodies. The first tagma of the fly, the head, consists of ocelli, antennae, compound eyes, and the mouthparts (the labrum, labium, mandible and maxilla make up the mouthparts). The second tagma, the thorax, bears the wings and contains the flight muscles on the second segment, which is greatly enlarged; the first and third segments have been reduced to collar-like structures. The third segment of the thorax bears the halteres, which help to balance the insect during flight. A further adaptation for flight is the reduction in number of the neural ganglia, and concentration of nerve tissue in the thorax, a feature that is most extreme in the highly derived Muscomorpha infraorder.
Flies have a mobile head with eyes and in most cases have large compound eyes on the sides of the head, with three small ocelli on the top. For visual course control, flies optic flow field is analyzed by a set of motion-sensitive neurons. A subset of these neurons is thought to be involved in using the optic flow to estimate the parameters of self-motion, such as yaw, roll, and sideward translation. Other neurons are thought to be involved in analyzing the content of the visual scene itself, such as separating figures from ground using motion parallax. The H1 neuron is responsible for detecting horizontal motion across the entire visual field of the fly, allowing the fly to generate and guide stabilizing motor corrections mid-flight with respect to yaw. The antennae take a variety of forms, but are often short, which reduces drag while flying.