Acid–base homeostasis is the homeostatic regulation of the pH of the body's extracellular fluid (ECF). The proper balance between the acids and bases (i.e. the pH) in the ECF is crucial for the normal physiology of the body—and for cellular metabolism. The pH of the intracellular fluid and the extracellular fluid need to be maintained at a constant level.
 The three dimensional structures of many extracellular proteins, such as the plasma proteins and membrane proteins of the body's cells, are very sensitive to the extracellular pH. Stringent mechanisms therefore exist to maintain the pH within very narrow limits. Outside the acceptable range of pH, proteins are denatured (i.e. their 3D structure is disrupted), causing enzymes and ion channels (among others) to malfunction.
 An acid–base imbalance is known as acidemia when the pH is acidic, or alkalemia when the pH is alkaline.
 In humans and many other animals, acid–base homeostasis is maintained by multiple mechanisms involved in three lines of defense:
 The second and third lines of defense operate by making changes to the buffers, each of which consists of two components: a weak acid and its conjugate base. It is the ratio concentration of the weak acid to its conjugate base that determines the pH of the solution. Thus, by manipulating firstly the concentration of the weak acid, and secondly that of its conjugate base, the pH of the extracellular fluid (ECF) can be adjusted very accurately to the correct value. The bicarbonate buffer, consisting of a mixture of carbonic acid (H2CO3) and a bicarbonate (HCO−3) salt in solution, is the most abundant buffer in the extracellular fluid, and it is also the buffer whose acid-to-base ratio can be changed very easily and rapidly.
 The pH of the extracellular fluid, including the blood plasma, is normally tightly regulated between 7.32 and 7.42 by the chemical buffers, the respiratory system, and the renal system. The normal pH in the fetus differs from that in the adult. In the fetus, the pH in the umbilical vein pH is normally 7.25 to 7.45 and that in the umbilical artery is normally 7.18 to 7.38.
 Aqueous buffer solutions will react with strong acids or strong bases by absorbing excess H+ ions, or OH− ions, replacing the strong acids and bases with weak acids and weak bases. This has the effect of damping the effect of pH changes, or reducing the pH change that would otherwise have occurred. But buffers cannot correct abnormal pH levels in a solution, be that solution in a test tube or in the extracellular fluid. Buffers typically consist of a pair of compounds in solution, one of which is a weak acid and the other a weak base. The most abundant buffer in the ECF consists of a solution of carbonic acid (H2CO3), and the bicarbonate (HCO−3) salt of, usually, sodium (Na+). Thus, when there is an excess of OH− ions in the solution carbonic acid partially neutralizes them by forming H2O and bicarbonate (HCO−3) ions. Similarly an excess of H+ ions is partially neutralized by the bicarbonate component of the buffer solution to form carbonic acid (H2CO3), which, because it is a weak acid, remains largely in the undissociated form, releasing far fewer H+ ions into the solution than the original strong acid would have done.
 The pH of a buffer solution depends solely on the ratio of the molar concentrations of the weak acid to the weak base. The higher the concentration of the weak acid in the solution (compared to the weak base) the lower the resulting pH of the solution. Similarly, if the weak base predominates the higher the resulting pH.
 This principle is exploited to regulate the pH of the extracellular fluids (rather than just buffering the pH). For the carbonic acid-bicarbonate buffer, a molar ratio of weak acid to weak base of 1:20 produces a pH of 7.4; and vice versa—when the pH of the extracellular fluids is 7.4 then the ratio of carbonic acid to bicarbonate ions in that fluid is 1:20.
 The Henderson–Hasselbalch equation, when applied to the carbonic acid-bicarbonate buffer system in the extracellular fluids, states that:
 where:
 However, since the carbonic acid concentration is directly proportional to the partial pressure of carbon dioxide (
  
    
      
        
          P
          
            
              
                
                  C
                  O
                
              
              
                2
              
            
          
        
      
    
    {\displaystyle P_{{\mathrm {CO} }_{2}}}
  
) in the extracellular fluid, the equation can be rewritten as follows:
 where:
 The pH of the extracellular fluids can thus be controlled by the regulation of 
  
    
      
        
          P
          
            
              
                
                  C
                  O
                
              
              
                2
              
            
          
        
      
    
    {\displaystyle P_{{\mathrm {CO} }_{2}}}
  
 and the other metabolic acids.
 Homeostatic control can change the PCO2 and hence the pH of the arterial plasma within a few seconds. The partial pressure of carbon dioxide in the arterial blood is monitored by the central chemoreceptors of the medulla oblongata. These chemoreceptors are sensitive to the levels of carbon dioxide and pH in the cerebrospinal fluid.
 The central chemoreceptors send their information to the respiratory centers in the medulla oblongata and pons of the brainstem. The respiratory centres then determine the average rate of ventilation of the alveoli of the lungs, to keep the PCO2 in the arterial blood constant. The respiratory center does so via motor neurons which activate the muscles of respiration (in particular, the diaphragm). A rise in the PCO2 in the arterial blood plasma above 5.3 kPa (40 mmHg) reflexly causes an increase in the rate and depth of breathing. Normal breathing is resumed when the partial pressure of carbon dioxide has returned to 5.3 kPa. The converse happens if the partial pressure of carbon dioxide falls below the normal range. Breathing may be temporally halted, or slowed down to allow carbon dioxide to accumulate once more in the lungs and arterial blood.
 The sensor for the plasma HCO−3 concentration is not known for certain. It is very probable that the renal tubular cells of the distal convoluted tubules are themselves sensitive to the pH of the plasma. The metabolism of these cells produces CO2, which is rapidly converted to H+ and HCO−3 through the action of carbonic anhydrase. When the extracellular fluids tend towards acidity, the renal tubular cells secrete the H+ ions into the tubular fluid from where they exit the body via the urine. The HCO−3 ions are simultaneously secreted into the blood plasma, thus raising the bicarbonate ion concentration in the plasma, lowering the carbonic acid/bicarbonate ion ratio, and consequently raising the pH of the plasma. The converse happens when the plasma pH rises above normal: bicarbonate ions are excreted into the urine, and hydrogen ions into the plasma. These combine with the bicarbonate ions in the plasma to form carbonic acid (H+ + HCO−3 
  
    
      
        ⇌
      
    
    {\displaystyle \rightleftharpoons }
  
 H2CO3), thus raising the carbonic acid:bicarbonate ratio in the extracellular fluids, and returning its pH to normal.
 In general, metabolism produces more waste acids than bases. Urine produced is generally acidic and is partially neutralized by the ammonia (NH3) that is excreted into the urine when glutamate and glutamine (carriers of excess, no longer needed, amino groups) are deaminated by the distal renal tubular epithelial cells. Thus some of the "acid content" of the urine resides in the resulting ammonium ion (NH4+) content of the urine, though this has no effect on pH homeostasis of the extracellular fluids.
 Acid–base imbalance occurs when a significant insult causes the blood pH to shift out of the normal range (7.32 to 7.42). An abnormally low pH in the extracellular fluid is called an acidemia and an abnormally high pH is called an alkalemia.
 Acidemia and alkalemia unambiguously refer to the actual change in the pH of the extracellular fluid (ECF). Two other similar sounding terms are acidosis and alkalosis. They refer to the customary effect of a component, respiratory or metabolic. Acidosis would cause an acidemia on its own (i.e. if left "uncompensated" by an alkalosis). Similarly, an alkalosis would cause an alkalemia on its own. In medical terminology, the terms acidosis and alkalosis should always be qualified by an adjective to indicate the etiology of the disturbance: respiratory (indicating a change in the partial pressure of carbon dioxide), or metabolic (indicating a change in the Base Excess of the ECF). There are therefore four different acid-base problems: metabolic acidosis, respiratory acidosis, metabolic alkalosis, and respiratory alkalosis. One or a combination of these conditions may occur simultaneously. For instance, a metabolic acidosis (as in uncontrolled diabetes mellitus) is almost always partially compensated by a respiratory alkalosis (hyperventilation). Similarly, a respiratory acidosis can be completely or partially corrected by a metabolic alkalosis.