In the fight against climate change, every ring in anatomy tells a story and every leaf holds a secret. Similarly, walnut populations in Pakistan's Dir and Swat districts face varying climatic conditions that affect their anatomy. However, the current study aims to explore the anatomical variations in walnut leaves and nuts to understand climate-driven adaptations. In the assessed study, the 44 sites examined were analyzed using scanning electron microscopy (SEM) to analyse epidermal cells, pith cells and vascular tissues. Walnut populations showed clear anatomical variations between districts. In the results, the Swat-selected specimens had larger epidermal cells (31.55–56.12 µm), phloem and pith cells, whereas the Dir specimens had larger xylem and palisade cells. Although high-altitude walnuts produced thinner shells and bigger cotyledons, the low-altitude trees had thicker shells. In short, these traits decreased with rising temperature and increased with altitude and light intensity. These findings have implications for plant taxonomy and conservation, suggesting anatomical variations can inform adaptation strategies and breeding programs in mountainous areas.