The main function of the kidneys is to filter harmful chemicals known as toxins from the blood.