The excretory organs of insects are called malpighian tubules. The malpighian tubules function by collecting water and uric acid from the surrounding blood. Urine is then formed by a process of secretion and emptied into the rectum to be excreted from the insect's body.
Malpighian tubules typically develop as pouches along the junction created by an insect's midgut and hindgut. Tracheae then attach to the tubules, anchoring them in place. Each tubule consists of a single layer of epithelial cells enclosed by an elastic membrane. Depending on the species, a single insect may have two to more than 150 malpighian tubules.