The Malpighian tubules (20) work with the insect hindgut to excrete nitrogenous waste products. This organ empties directly into the alimentary canal, and connects at the junction between the midgut and hindgut. The tubules themselves vary in number, from just two in some insects to over 100 in others. Like arms of an octopus, the Malpighian tubules extend throughout the insect's body.
The hindgut (16) also plays a role in excretion. The insect rectum retains 90% of the water present in the fecal pellet, and reabsorbs it back into the body. This function allows insects to survive and thrive in even the most arid climates.