Abstract Questions Stomata can reflect the plant's adaptation to environmental changes. However, the variation patterns of stomatal traits across different habitats and their relationships with environmental drivers are still poorly understood. Here, we assessed the extent of interspecific and intraspecific variation in stomatal traits in two typical riparian forests, and investigated how stomatal traits adapt to habitat change as well as trait–environment relationships. Location The Irtysh River Basin in China. Methods We measured the stomatal density (SD), stomatal size (SS), and stomatal relative area (SRA) of dominant plant species from two riparian forests: (1) a riparian forest in the valley and (2) a riparian forest in the pediment plain. We analyzed the stomatal trait variation patterns of dominant plant species in different habitats. We then quantified the magnitude of intraspecific and interspecific stomatal trait variability and evaluated the relationships between stomatal traits and environmental factors. Results We found that SD and SRA were significantly higher in pediment plain forests than in valley forests, whereas SS was not significantly different between these habitats. The SD and SRA of trees in pediment plain forests were significantly higher than those in valley forests, whereas there were no significant differences in understory plants between habitats. The interspecific variation in each stomatal trait was significantly higher than the intraspecific variation. Stomatal traits were more related to the soil environment than to climatic factors. Conclusions Response strategies of stomatal traits to habitat changes differed between species and functional groups, and trait–environment relationships depended on the habitat type of the riparian forest. Our analysis of stomata trait variation implies adaptive strategies in species of natural riparian forest. Insights into trait–environment relationships could be used to predict carbon and water cycling, and vegetation changes in riparian forests of arid regions, especially in the context of climate change.