For the biochemical process, see respiration

The respiratory system, also called the gas exchange system, is the body getting rid of carbon dioxide and taking in oxygen.  Carbon dioxide, a waste product, goes out of the body.  Oxygen, which the body needs, comes in. The lungs are the main organ to do this. In other words, the process in which oxidation of organic compounds occurs in cells and energy is released is called the Respiratory system. 

The first step in this process is breathing in air, or inhaling.  Inhalation means bringing air rich in oxygen into the body.  Exhalation means giving out air rich in carbon dioxide from the body.  The second step is gas exchange in the lungs where oxygen is diffused into the blood and the carbon dioxide diffuses out of the blood.  The third process is cellular respiration, which produces the chemical energy that the cells in the body need, and carbon dioxide. Finally, the carbon dioxide from cellular respiration is breathed out of the body from the lungs.

Breathing 
Breathing is the first step in respiration. For respiration to happen, the body needs a constant supply of oxygen, which is done by breathing. Inhalation is the breathing in of air. To inhale, the lungs expand, decreasing the air pressure in the lungs. This is caused by two actions. The diaphragm (a sheet of muscular tissue that separates the lungs from the abdomen) is pulled downward. Also the muscles between the ribs contract to expand the chest. Both of these actions expand the lungs. To fill the enlarged lungs, air from outside at higher pressure comes rushing into the area of low pressure in the lungs. Air first passes through the nose and mouth, then through the larynx (voice box), then down the trachea (windpipe), and into the lungs.

The lungs are made of many tubes or branches.  As air enters the lungs, it first goes through branches called the bronchi, then through smaller branches called bronchioles, and finally into the air sacs. Gas exchange occurs in the air sacs where oxygen is exchanged with carbon dioxide.  

The carbon dioxide in the air sacs now needs to be exhaled or breathed out.  In the reverse process of inhaling, the diaphragm and the rib muscles relax, causing the lungs to be smaller.  As the air pressure in the lungs is greater when the lungs are smaller, the air is forced out. The air sacs are able to contract and expand because they are coated with a lubricant, surfactant, this lubricant helps the air sacs inflate while also preventing the collapse of the lungs during deflation. The exhaled air has a high concentration of carbon dioxide and a low concentration of oxygen.  The maximum volume of air that can be breathed in and breathed out is called the vital capacity of the lungs and is up to five liters.

Gas exchange 

The inhaled air goes down to the air sacs at the end of each bronchiole.  The air sacs are called alveoli — they have a large surface area and are moist, thin, and close to a blood supply.  The inhaled air has a much greater concentration of oxygen than carbon dioxide whilst the blood flowing to the lungs has more carbon dioxide than oxygen.  This creates a concentration gradient between the air in the air sacs and the blood, meaning there is more oxygen in the air than the blood.  

As the membrane, oxygen can easily diffuse in and out. Oxygen at high concentration in the air sacs diffuses into the blood where oxygen concentration is low, and carbon dioxide at high concentration in the blood diffuses into the air sacs where carbon dioxide concentration is low.  The oxygen in the blood enters the circulatory system and is used by the cells in the body.  The carbon dioxide in the air sacs is exhaled out of the body.

Related pages 
 Respiration
 Respiratory tract

References

Physiology