The lungs are internal organs that absorb oxygen into the body and remove carbon dioxide. They have a large surface area to absorb as much oxygen as possible.
All of the mammals, reptiles and amphibians alive today absorb oxygen through their lungs, including water-dwelling mammals such as whales and dolphins. Their lungs are homologous organs (they come from a common ancestor) and are evidence that we are all related.
There are also 6 species of lungfish, in Australia, South America and Africa. As their name suggests, they all have lungs that can absorb air from water with low levels of oxygen.
A few species of fish were the first creatures to evolve lungs.
Arapaima, from the Amazon River, is an example of a fish that evolved a lung-like gas bladder to supplement the oxygen from its gills.
About 375 million years ago, land-living animals began to evolve from a species of lobe-finned fish. All animals with lungs share this common ancestor. This species is now extinct, but the living lungfish are close relatives.
To live on land, the early tetrapods, 4-legged creatures, had to be able to breathe air through their lungs, and they also needed a rib cage to prevent the lungs from being crushed.
The lungs of some species have evolved so that they can take in greater quantities of oxygen in shorter periods of time. Mammals, including humans, have very efficient lungs and this is one of the reasons why they are able to carry out quite intense activity and exercise.
However, the basic structure is the same as in the bodies of all the other tetrapods.
Before some fish evolved into tetrapods, and crawled out onto land, most fish absorbed oxygen through their gills.
Gills have the same role as lungs but they are found on the surface of a fish’s body and they absorb oxygen from water taken into the fish's mouth.