The main function of the kidneys is to filter harmful chemicals known as toxins from the blood. These toxins are secreted into the urine.