Gas exchange
Gas exchange or respiration takes place at a respiratory surface - a boundary between the external environment and the interior of the body. For unicellular organisms the respiratory surface is simply the cell membrane, but for large organisms it usually is carried out in respiratory systems.
This name can cause problems - in biology the word "respiration" can mean cellular respiration or metabolism (ATP generation inside cells), however sometimes (such as here) it can also refer to breathing (which is how the word is most often used by non-biologists).
Gases cross the respiratory surface by diffusion, so from Fick's law we can predict that respiratory surfaces must have:
- a large surface area
- a thin permeable surface
- a moist exchange surface
Many also have a mechanism to maximise the diffusion gradient by replenishing the source and/or sink.
Control of respiration is due to rhythmical breathing generated by the phrenic nerve to stimulate contraction and relaxation of the diaphragm during inspiration and expiration.  Ventilation is controlled by partial pressures of oxygen and carbon dioxide and the concentration of hydrogen ions. The control of respiration can vary in certain circumstances such as during exercise.

# Gas exchange in humans and mammals
In humans and other mammals, respiratory gas exchange or ventilation is carried out by mechanisms of the lungs. The actual exchange of gases occurs in the alveoli.
Convection occurs over the majority of the transport pathway. Diffusion occurs only over very short distances. The primary force applied in the respiratory tract is supplied by atmospheric pressure. Total atmospheric pressure at sea level is 760 mm Hg, with oxygen (O2) providing a partial pressure (pO2) of 160 mm Hg, 21% by volume, at the entrance of the nares, and an estimated pO2 of 100 mm Hg in the alveoli sac, pressure drop due to conduction loss as oxygen travels along the transport passageway. Atmospheric pressure decreases as altitude increases making effective breathing more difficult at higher altitudes.
Gas exchange occurs only at pulmonary and systemic capillary beds.
CO2 is a result of cellular respiration.  The concentration of this gas in the breath can be measured using a capnograph.  As a secondary measurement, respiration rate can be derived from a CO2 breath waveform.
Trace gases present in breath at levels lower than a part per million are  ammonia, acetone, isoprene. These can be measured using selected ion flow tube mass spectrometry.

## Transporting of oxygen, carbon dioxide, and hydrogen ions
Blood carries oxygen, carbon dioxide and hydrogen ions between tissues and the lungs.
The majority (70%) of CO2 transported in the blood is dissolved in plasma (primarily as dissolved bicarbonate; 60%).  A smaller fraction (30%) is transported in red blood cells combined with the globin portion of hemoglobin as carbaminohemoglobin.
AS CO2 diffuses into the blood stream 93% goes into RBCs and 7% is dissolved in plasma.  70% is converted into H2CO3 by Carbonic Anhydrase. The H2CO3 dissociates into H+ and HCO-3. The HCO-3 moves out of the RBC in exchange for CL-(chloride shift). The hydrogen is removed by buffers in the blood (Hb).