A coral reef's food chain starts with algae that produce food from water, carbon dioxide and sunlight, which are eaten by microscopic organisms, invertebrates, fish and turtles, which are eaten in turn by predators. All ecosystems, including coral reef ecosystems, have producers, consumers and decomposers.
Coral reefs are created by coral, invertebrate animals related to sea anemones and jellyfish that live in large colonies and secrete hard skeletons made of calcium carbonate. Corals cannot produce their own food, but many are hosts to various species of algae within their tissues that they protect, and they receive energy from them in return. Some corals consume small fish or invertebrates that float by. Other algae live outside of the corals, as free-floating single cells or as seaweed.
Corals and algae are eaten by various types of fish and other animals. Butterfly fish, file fish and damselfish are specialized coral eaters, although different species eat different parts of the corals. At the end of the food chain are the decomposers and detritivores that break down dead organisms. In the coral reef, these are primarily bacteria. Animal species also contribute to nutrient-recycling that the bacteria perform, however, including sea cucumbers, snails, crabs and bristle worms.