The carbon-oxygen cycle involves photosynthesis and respiration. During photosynthesis, plants and algae take in carbon dioxide from the air or water and release oxygen. Animals and decomposers then take in the oxygen to respire and release carbon dioxide, which is taken up again by plants. Carbon is stored in organisms as organic compounds and remains stored in dead matter until decomposition releases it back as carbon dioxide, with some carbon becoming trapped in fossil fuels over millions of years.