Gaseous exchange takes place in the lungs' alveoli, which are tiny sacs found at the ends of the terminal bronchioles. The gases that are exchanged are oxygen and carbon dioxide.
The gases can be easily exchanged at the level of the alveoli because these sacs are only one or two cells thick and have a great deal of surface area. The lungs also contain hundreds of millions of them. The capillaries that flow into the alveoli are also only about one cell thick, and blood cells can only pass through them one at a time.
One of the functions of the blood is to get oxygen into the cells of the body. When the blood is depleted of its oxygen, it returns by way of the pulmonary artery to the alveolar capillaries in the lungs. Once in the alveoli, the carbon dioxide in the blood is expelled by the alveoli up through the bronchi of the lungs and the trachea then expelled from the body through exhalation.
At the same time, oxygen enters the alveoli, and the alveoli sends oxygen to the capillaries. The capillaries then give oxygen to the depleted venous blood. This oxygenated blood is sent through the capillaries toward the heart.