Adelheid ("Heidi") is a girl who has been raised by her aunt Dete in Maienfeld, Switzerland after the early deaths of her parents, Tobias and Adelheid. Dete brings 5-year-old Heidi to her grandfather, who has been at odds with the villagers for years and lives in seclusion on the alm. This has earned him the nickname Alp-Öhi ("Alm Uncle" in the Graubünden dialect). He at first resents Heidi's arrival, but the girl manages to penetrate his harsh exterior and Heidi subsequently has a delightful stay with him and her best friend, young Peter the goat-herd.
Dete returns three years later to bring Heidi to Frankfurt am Main as a companion of a 12-year-old girl named Clara Sesemann, who is regarded as an invalid. Heidi spends a year with Clara, conflicting with the Sesemanns' strict housekeeper Fräulein Rottenmeier and becoming more and more homesick. Her one diversion is learning to read and write, motivated by her desire to go home and read to Peter's blind grandmother. Heidi's increasingly failing health, and several instances of sleepwalking cause hysteria in the household that there is a haunting, prompt Clara's doctor to send Heidi home to her grandfather. Her return prompts the grandfather to descend to the village for the first time in years, marking an end to his seclusion.
Heidi and Clara continue to contact each other. A visit by the doctor to Heidi and her grandfather convinces him to recommend Clara to visit Heidi. Meanwhile, Heidi teaches Peter to read and write. Clara makes the journey the next season and spends a wonderful summer with Heidi. Clara becomes stronger on goat's milk and fresh mountain air, but Peter, feeling deprived of Heidi's attention, pushes Clara's wheelchair down the mountain to its destruction. Without her wheelchair, Clara attempts to walk and is gradually successful. Clara's grandmother and father are amazed and overcome with joy to see Clara walking. Clara's wealthy family promises to provide a shelter for Heidi, in case her grandfather is no longer able to do so