Promoting sustainable lifestyles through Education for Sustainable Development (ESD) is part of the UN’s Agenda 2030. Earlier empirical studies proved direct interactions with and in natural environments to be effective ESD methods. Pandemic-related lockdowns rendered such courses nearly impossible, which raised concerns about achieving the Sustainable Development Goals (SDGs) in general. To evaluate what young learners know about the concept sustainability so far and how it can be taught effectively online, we designed an online learning module tackling sustainability issues and compared it with data from an on-site intervention module for Bavarian 5th graders (~ 10 years old). Cognitive learning as well as attitudinal preferences of 288 learners were monitored in a pretest–posttest design. The learning module comprised two sections: One about botany, plant characteristics, and plant families; the other about the advantages and disadvantages of traditional as well as sustainable farming methods. The customized cognitive test and semantic differentials for sustainability and environmental protection produced three major findings: (1) A digital learning environment successfully and significantly increased sustainability knowledge (2) Learners clearly distinguished the concepts Sustainability and Environmental Protection (3) There is no direct correlation between semantic differential scores and learning outcome.