This plant is often found in moist habitat types, but it can occur in drier areas. It is often associated with limestone and other types of calcareous substrate. It may also occur on granite soils. It grows in coniferous forests, woods, meadows, and riverbanks. In the northern part of its range it usually grows in coniferous forest habitat. In the Black Hills area it can be found alongside Picea glauca, Pinus ponderosa, and Populus tremuloides. It usually grows in the understory, but occasionally it may be found in more open habitat. The plant is often associated with various mosses, such as feather moss, Hylocomium splendens. It may grow in moss carpets.