When a plant or animal dies, it leaves behind nutrients and energy in the organic material that comprised its body. Scavengers and detritivores can feed on the carcasses, but they will inevitably leave behind a considerable amount of unused energy and nutrients. Unused energy and nutrients will be present both in the unconsumed portions (bones, feathers or fur in the case of animals, wood and other indigestable litter in the case of plants) and in the feces of the scavengers and detritivores. Decomposers complete decomposition by breaking down this remaining organic matter. Decomposers eventually convert all organic matter into carbon dioxide (which they respire) and nutrients. This releases raw nutrients (such as nitrogen, phosphorus, and magnesium) in a a form usable to plants and algae, which incorporate the chemicals into their own cells. This process resupplies nutrients to the ecosystem, in turn allowing for greater primary production. 

Although decomposers are generally located on the bottom of ecosystem diagrams such as food chains, food webs, and energy pyramids, decomposers in the biosphere are crucial to the environment. By breaking down dead material, they provide the nutrients that other organisms need to survive. As decomposers feed on dead organisms, they leave behind nutrients. These nutrients become part of the soil. Therefore, more plants can grow and thrive. 

Bacteria are the primary decomposers of dead animals (carrion) and are the primary decomposers of dead plant matter (litter) in some ecosystems