The respiratory system is adapted for gas exchange between the air and blood. Oxygen diffuses into the alveoli and into blood capillaries, while carbon dioxide diffuses out. The diaphragm and intercostal muscles drive breathing by expanding the lungs to inhale air and relaxing to exhale. Gas exchange occurs through the thin walls of alveoli surrounded by capillaries, allowing oxygenation of blood and removal of carbon dioxide.