Diatoms live in water, or even in moist habitats or soils. Some diatoms live as free-floating cells in the plankton of ponds, lakes and oceans. Planktonic species often have special adaptations to prevent sinking, including the formation of long chains of cells, linked by silica spines. Other species form zig-zag or star-shaped colonies that are buoyant and resistant to sinking.
Other diatoms form attachments to surfaces, such as rocks or submerged organisms by mucilage pads. Many of these species have cells that are shaped to aid in attachment. For example, the silica cell wall may be arched to fit nicely to the stem of a bit of aquatic moss.
Some diatom species are attached to surfaces by stalks. The stalks may be short, or long and branching. Some species even form mucilage tubes that cells live inside. Stalks function to hold the cells in place and are resistant to waves or high flow in rivers. Stalks also appear to function to obtain nutrients from the water.
Diatoms that have a special structure, called a raphe, are able to move over surfaces. These diatoms can move over fine grains of sand, or within the mud of a tidal zone, or even on other diatoms. Diatoms have differing abilities to move, depending on the species. The more developed the raphe, the faster the diatoms can move.