Many cavity nesters need hollow trees in specific sites. Tree swallows and prothonotary warblers generally use cavities located over water. Several ducks, including wood ducks, goldeneyes, mergansers and buffleheads, use hollow trees in or near water. Barred owls usually use cavities located in bottomland forests, while great crested flycatchers prefer cavities near clearings or woodland edges. Great horned owls, screech owls, chickadees, nuthatches, wrens and titmice use cavities in a variety of forest and woodland habitats.
Birds use cavities to protect their eggs and young from predators.
Red cockaded woodpeckers, once abundant in the Missouri Ozarks, would excavate cavities in live old pines and then create a series of smaller holes around the entrance. These smaller holes oozed pine resin, forming a sticky barrier that made it difficult for snakes to reach their nests. Some species select a cavity with the smallest opening they can squeeze through. A small opening excludes nest predators, such as blue jays and raccoons and nest parasites, like brown-headed cowbirds. It also bars larger cavity users that would otherwise compete for a particular cavity.