information:filtering, structural:expansion, structural:reformatting
Ecology

Many cnidarians are limited to shallow waters because they depend on endosymbiotic algae for much of their nutrients. The life cycles of most have polyp stages, which are limited to locations that offer stable substrates. Nevertheless, major cnidarian groups contain species that have escaped these limitations. Hydrozoans have a worldwide range: some, such as Hydra, live in freshwater; Obelia appears in the coastal waters of all the oceans; and Liriope can form large shoals near the surface in mid-ocean. Among anthozoans, a few scleractinian corals, sea pens and sea fans live in deep, cold waters, and some sea anemones inhabit polar seabeds while others live near hydrothermal vents over 10 km (33,000 ft) below sea-level. Reef -building corals are limited to tropical seas between 30°N and 30°S with a maximum depth of 46 m (151 ft), temperatures between 20 and 28 °C (68 and 82 °F), high salinity, and low carbon dioxide levels. Stauromedusae, although usually classified as jellyfish, are stalked, sessile animals that live in cool to Arctic waters. Cnidarians range in size from a mere handful of cells for the parasitic myxozoans through Hydra' s length of 5–20 mm (1 ⁄ 4 – 3 ⁄ 4 in), to the Lion's mane jellyfish, which may exceed 2 m (6 ft 7 in) in diameter and 75 m (246 ft) in length.

Prey of cnidarians ranges from plankton to animals several times larger than themselves. Some cnidarians are parasites, mainly on jellyfish but a few are major pests of fish. Others obtain most of their nourishment from endosymbiotic algae or dissolved nutrients. Predators of cnidarians include: sea slugs, flatworms and comb jellies, which can incorporate nematocysts into their own bodies for self-defense (nematocysts used by cnidarian predators are referred to as kleptocnidae); starfish, notably the crown of thorns starfish, which can devastate corals; butterfly fish and parrot fish, which eat corals; and marine turtles, which eat jellyfish. Some sea anemones and jellyfish have a symbiotic relationship with some fish; for example clownfish live among the tentacles of sea anemones, and each partner protects the other against predators.

Coral reefs form some of the world's most productive ecosystems. Common coral reef cnidarians include both Anthozoans (hard corals, octocorals, anemones) and Hydrozoans (fire corals, lace corals). The endosymbiotic algae of many cnidarian species are very effective primary producers, in other words converters of inorganic chemicals into organic ones that other organisms can use, and their coral hosts use these organic chemicals very efficiently. In addition, reefs provide complex and varied habitats that support a wide range of other organisms. Fringing reefs just below low- tide level also have a mutually beneficial relationship with mangrove forests at high-tide level and seagrass meadows in between: the reefs protect the mangroves and seagrass from strong currents and waves that would damage them or erode the sediments in which they are rooted, while the mangroves and seagrass protect the coral from large influxes of silt, fresh water and pollutants. This additional level of variety in the environment is beneficial to many types of coral reef animals, which for example may feed in the sea grass and use the reefs for protection or breeding.