Like other plants, the zooxanthellae in the coral tissue uses photosynthesis as a means of harnessing the sun's light and converting it to nutrients. Some of these nutrients, like oxygen and sugars, are used by the coral. The coral also produces waste products that the algae can use. Carbon dioxide, nitrates, and phosphates are waste products of the coral but important nutrients for the zooxanthellae. This recycling of nutrients allows corals to thrive in the nutrient poor waters of the tropics.
Corals also feed on small planktonic animals.
Corals use their tentacles to capture prey. The tentacles contain stinging cells called nematocysts. When an animal brushes against the nematocyst a spear-like projection shoots out and captures the animal. Coral needs the sunlight and clear, shallow water so that the zooxanthellae in their tissues can photosynthesize. In waters that are either too deep or too murky, the zooxanthellae does not get enough light to photosynthesize.