Flies are holometabolous, therefore they have four distinct morphological stages; egg, larva (maggot), pupa and adult. After hatching from the egg, larvae molt twice as they grow. Molting of maggots is difficult to see. Larvae are maggots with a legless soft body except for the dark mouth hooks. Pupae are dark, and look like a small barrel.
Males and females are hard to distinguish. Females are usually larger and can extend the tip of the abdomen to form an ovipositor which is used to lay eggs. Sometimes males have enlarged eyes which meet on top of the head.
Larvae feed on decaying meat and feces. Adult flies feed on sugary food of any kind, including nectar and rotting fruit.
Flies live in garbage and wherever animal feces are available. Dead animals attract flies within hours after death. Most flies are diurnal.
Many birds, bats, spiders, and insects such as dragonflies eat the adults. Predatory and parasitic insects eat the larvae. The eyes of flies are among the most complex in the insect world. They are compound eyes with many individual facets, each representing a separate light-detecting unit. The light reflected from the eye of a horsefly can form a rainbow. Flies taste, smell, and feel with the hairs that cover their bodies. The hairs on the flyâ€™s mouth parts and feet are used for tasting. Flies taste what they walk on. If they walk onto something tasty, they put down their mouth and taste it again. Flies use other hairs to tell them when they touch something. These hairs bend when touched. The eyes of a fly do not have eyelids, so flies rub their eyes with their feet to keep them clean. A fly cleans itself constantly. Flies walk on smooth surfaces using sticky soft pads that act like glue. This allows them to walk on vertical glass surfaces and upside down.