Energy is transferred through ecosystems via food chains and food webs. Green plants, or producers, trap energy from the sun through photosynthesis and serve as the base of the food chain. Herbivores obtain energy by eating plants, and carnivores obtain energy by eating herbivores or other carnivores. Decomposers, like bacteria and fungi, break down dead organisms and waste and release nutrients back into the soil. Energy and matter are transferred and pass between trophic levels as organisms consume other organisms in an ecosystem.