The vast majority of crabs have gills, much like fish, which extract oxygen dissolved in water. Even when they are on land, the gills can still absorb oxygen as long as they are kept moist. There is also a small selection of land crabs that have dual-circulatory systems, meaning they have lungs as well as gills.Know More
For the crabs that do not have lungs, if the gills are kept moist, they can breathe just as well on land as they do in the water. This is why crabs like small, dark and moist hiding places when they venture onto land. Different types of crab have different gills and in different places, but they work in very similar ways.
The gills are usually made of thin filaments of tissue that are heavily folded in order to increase the surface area of the organ. Through gaseous exchange, the gills pass carbon dioxide from the body and receive oxygen from the surrounding environment. In water, oxygen diffuses slowly and only makes up a fraction of the amount found in air. Oxygen in water makes up about 8 cubic centimeters per liter whereas it makes up about 220 cubic centimeters in air. Water is denser; the density helps keep gills from collapsing onto each other.