Inhaling happens when a special muscle within the chest, called the diaphragm, contracts and expands the lungs, pulling in air. Conversely, exhaling occurs when the diaphragm relaxes and air is pushed out of the lungs.
The entire breathing process relies on the diaphragm to control the lungs and related muscles. Inhaling begins with a contraction of the diaphragm, which causes the chest cavity to enlarge. This, in turn, leads to the lungs expanding to fill the newly enlarged chest. As the lungs expand, they reactively pull in air through the nose and mouth because they are directly linked via the windpipe. Once the lungs and chest cavity reach their maximum size, the inhaled air is absorbed into the lungs thorough the bronchial tubes. Oxygen is removed from the inhaled air, and is replaced with carbon dioxide within the alveoli.
Once this exchange is complete, the process reverses, and this time the diaphragm relaxes. As the muscle returns to its neutral state, the rib cage contracts. This causes the lungs to decrease in size. When the lungs shrink back to their smaller size, the air filling them is pushed back up the wind pipe and out through the nose and mouth.