The kidney, however, must ultimately excrete the extra acid that is present and retain basic bicarbonate in the body. There are four basic classes of pH disturbances that can occur. Respiratory acidosis occurs when respirations are impaired, for example with lung disease, sedative overdose or airway obstruction. Because the respiratory acid, carbon dioxide, cannot be exhaled, it is retained resulting in acidosis of respiratory origin. When respiratory acidosis occurs the kidneys compensate by retaining basic bicarbonate.
Respiratory alkalosis can occur when traveling to high altitudes, or with hyperventilation.
In these cases, rapid respirations causes excess carbon dioxide to be removed from the body resulting in alkalosis of respiratory origin. The kidneys compensate by excreting more basic bicarbonate in the urine. Metabolic acidosis often occurs in uncontrolled diabetes when acidic ketones are formed. Due to the inability to use glucose as an energy source, abnormal amounts of fat are broken down resulting in the formation of ketones. Metabolic acidosis can also occur with retention of acids that occurs in kidney failure or with severe diarrhea .