Thamnophis elegans occurs in a wide variety of habitats, including grasslands, woodlands, and coniferous forests, from sea level up to . It is primarily terrestrial, although populations in the Great Basin and Rocky Mountains are semi-aquatic.