After living for five years with her aunt Dete without being allowed to leave the house, an orphan girl called Heidi is being taken to the Swiss Alps to stay with her grandfather. Dete has gotten a job in Frankfurt and can't take Heidi with her, which is why she ignores the neighbors' warnings about grampa being antisocial and possibly dangerous. On their way up the mountain, Heidi takes off her boots and dress to run around in her underdress, preferring the freedom of movement to being fashionable.
As soon as he sees them arrive, grampa Alpöhl gets angry and kicks them out, saying he doesn't want to take care of the girl. Dete pretends to leave with the child, but in truth, she takes Heidi behind the house and tells her to stay while she runs away. Alpöhi notices this and yells at Dete, but Heidi tells him she doesn't want her either.
Refusing to accept the girl in his life, Alpöhi enters his home and locks the door, so Heidi decides to sleep in the barn with the goats. The next morning, Alpöhi gives Heidi some goat milk as breakfast and then takes her to church. The priest takes a close look at Heidi and declares her healthy and strong.
He thinks it's Alpöhi's duty to take care of his own blood, but since grampa won't change his mind, the priest comments he'll be going to Maienfeld in three days so he can take Heidi with him to see if any farmer will have a use for her. When they return home, Heidi wonders if she should sleep in the barn again, and Alpöhi tells her she can sleep wherever she wants. Since Alpöhi only has one bed and one chair, Heidi looks for another spot and finds a set of stairs that she climbs to find an attic full of hay.
After deciding that will be her bedroom, Heidi tells Alpöhi that she would rather not leave, but gets no answer. The following day, goatherd Peter comes over to pick up Alpöhi's goats and grampa gets the chance to ask him to take Heidi with him for the day, perhaps even teach her how things are done in the mountains. After Alpöhi gives Heidi some cheese and sausage for her lunch, Heidi is happy to join Peter and spend the day running with the goats, enjoying this much more than being inside the house all day like her aunt used to make her.
While Heidi has fun, Peter takes a bite from her food, then blames it on the goats when Heidi notices. Suddenly, two goats begin fighting and Peter hits them with a stick to make them stop. Heidi greatly disapproves of this and, after making him stop, she offers a deal: if he never hits a goat again, she'll give half of her food to him every day.
Peter gladly accepts, but asks her to promise not to tell Alpöhi because people in town say he killed someone in the past. When Heidi returns home, she acts awkwardly around her grampa and says she'll sleep in the barn, so Alpöhi quickly guesses she's heard the rumors. He asks Heidi what she trusts more: rumors, or her own eyes and ears.
Heidi chooses her own judgment and hugs Alpöhi before going to sleep in the attic. The next day, while Heidi continues to have fun and bond with Peter, Alpöhi does some carpentry to show his granddaughter how touched he is by her affection. When Heidi comes home, she's surprised to find a second chair at the table and some fantastic news: Alpöhi will allow her to stay for good.
Weeks pass and Heidi has fun with Peter every day, she even cuts her hair to be more comfortable. One day, Peter tells her he won't be coming for a few months because he'll be going to school, so they'll see each other again in the spring, but she should come by his house to visit him sometime. Heidi wants to go to school too, and whenever they go to town, the neighbors also remind Alpöhi that a kid needs education and friends.
Alpöhi refuses though, explaining Heidi won't be able to come down the mountain to attend school when winter comes. Things get boring when it begins to snow. Alpöhi carves a little bird for Heidi to make her feel better but it doesn't help much, so he tries to make a sleigh next.
This actually works well, and the two of them have fun sleighing down the mountain before Alpöhi drops Heidi at Peter's for a playdate. Heidi gets to meet Peter's mother and grandmother, but his dad is dead. The grandmother is blind and there aren't many things she can eat because she missing most of her teeth, which is a problem because all they have to eat is stale bread.
Peter isn't doing well at school and doesn't understand why he needs to learn to read because he doesn't need it to herd goats, but his mother doesn't allow him to quit. When Alpöhi comes to pick Heidi up, she tells him she's realized how lucky she's to have him. Years pass and Heidi lives a peaceful, happy life with her grandpa.
One day, Dete comes back saying she's found a nice place for Heidi with her employers, which would allow her to make friends and go to school. However, Alpöhi refuses to allow Heidi to leave and points out how Dete suddenly cares about her niece all of the sudden. Embarrassed, Dete responds she only left Heidi because she didn't have a choice back then.
She argues with Alpöhi but doesn't get to change his mind, so Dete pretends to leave when actually she goes further into the mountains to find Heidi among the goats. Dete makes the offer again, and when Heidi replies she wants to stay, Dete tells her Alpöhi also wants her to go because he wants what's best for her. Upset, Heidi allows Dete to take her away, and Peter sees all this.
When he takes the goats back to Alpöhi, grampa notices Heidi is gone and quickly guesses what happened, so he runs all the way to town. But by the time he gets there, it's too late: Dete's already left with Heidi, and the neighbors make fun of Alpöhi for it. In Frankfurt, Heidi is taken to the Sesemann mansion, where he meets the butler Sebastian, the maid Tinette, and, most importantly, governess Rottenmeier.
This Rottenmeier lady isn't happy to see Heidi because she looks like a wild child with no manners, but Dete reminds her this is what they asked for: an unspoiled child of this age to be friends with the house's kid, Klara. While Dete demands her part of the deal and leaves, Heidi meets Klara, who can't walk and is wheelchair-bound. The girls immediately hit it off and when Heidi accidentally pushes Klara's chair against the table, Klara lies to protect her and tells Rottenmeier that it was her fault.
There's a lot for Heidi to learn in order to be accepted as Klara's companion. They wash her, give her a proper dress and boots, teach her table manners and forbid her from running around the house or being loud. Heidi must also take classes with Klara and shocks everyone when she confesses she can't read.
Rottenmeier wants to get rid of her, but she can't do that until Klara's dad comes back from his trip, so in the meantime, the instructor must teach Heidi how to read while still keeping up with Klara's lessons. Heidi adapts quickly to the rules of the house, but she doesn't change entirely and keeps most of her quirks. She still prefers nature over a house and dreams of the mountains every night, and whenever she can get away with it, she hides bread rolls in her pockets.
She and Klara grow very close; this bond inspires Klara to share what happened to her: after her mother's death, Klara became so ill that she lost her ability to walk. Before Heidi came along, she felt lonely and caged in this house because her father's always away on business trips. One afternoon, Heidi refuses to take the daily nap and asks Sebastian to open a window for her.
Sadly, she still can't see the mountains, causing Sebastian to explain that in order to see the mountains from here, she would have to get into the very tall city tower. Afterward, Heidi sneaks Klara out of the house and shows her around the city, because Klara is never allowed to go outside. When they find the city tower, Klara waits by the door while Heidi goes as high as possible, only to get disappointed when not even up here it's possible to see the mountains.
Klara is a little nervous to be alone, but her mood improves when she finds a person selling kittens and decides to buy them all. Back at the house, Rottenmeier panics when she can't find the girls and sends all the servants out to search for them. It's Sebastian who finds them, and Klara fortunately covers the kitties with the blanket they came with before he can see them.
When they return home, Rottenmeier tries to scold them, but ends up sneezing like crazy because of her allergies. The cats suddenly jumped off Klara's lap, scaring Rottenmeier so badly that she climbs on the furniture, making everyone laugh. Later at dinner, as punishment.
Heidi isn't allowed to eat - instead, she must stand in the corner of the room, facing the wall during the whole meal. Rottenmeier promises that next time she'll send her to the cellar with the rats. Heidi won't stand for this, so after dinner, she picks up all the bread rolls she's saved for Peter's grandmother and tries to leave.
Rottenmeier stops her, reminding her she's lucky to be receiving fancy clothes and proper education. But what truly makes Heidi feel bad is seeing a disappointed Klara crying and rushing to her room. Since that day, Heidi's dreams get worse, and Klara won't leave her room.
Tinette explains she's sick and blames Heidi for it. Feeling even worse now, Heidi visits Klara once her doctor says she's feeling better, and reassures her it's not because she hates her that she wants to leave. Klara understands but still doesn't want Heidi to go because she's all she has.
With Heidi back at her side, Klara begins leaving her room again and attends classes, but reading isn't coming easily for Heidi. A couple of days later, Klara's father Mr Sesemann finally comes home and brings with him Grandmother Sesemann, who Rottenmeier isn't happy to see. Klara is very excited to reunite with her family, and both Sesemanns are glad to finally meet Heidi too.
Mr Sesemann in particular is very satisfied with how better Klara looks thanks to his idea of getting her a friend, but Rottenmeier tries to change his mind by explaining Heidi continues to be wild and won't learn to read. However, Grandmother Sesemann would rather confirm it with her own eyes than trust Rottenmeier's word. Later in the evening, Grandmother Sesemann reads Heidi a bedtime story but doesn't finish it because she wants Heidi to do it.
Heidi confesses she can't read because Peter said it was useless, so Grandmother Sesemann reminds her that she mustn't trust everything she hears. Since Heidi loves stories and is desperate to know how this one ends, she accepts to put more effort and practice more often. The next day, Grandmother Sesemann tells her son that Heidi is wonderful and she can learn to read with the right encouragement, but she can tell the kid isn't happy because this house goes against everything she is.
Mr Sesemann refuses to let Heidi go because she makes Klara happy, but Grandmother Sesemann points out he wants her to stay because she makes him feel less guilty about leaving Klara alone all the time. Things don't get any easier when strange noises begin echoing around the house every night, and sometimes Sebastian even finds the front door open. All the servants and even Rottenmeier think there may be ghosts in the house, but Mr Sesemann doesn't believe it.
With every day that passes, Heidi practices her reading more with the book that Grandmother Sesemann left her, and eventually manages to read the whole story to everyone. The teacher takes all the credit, and Mr Sesemann decides this shows Heidi is good enough to stay in the house for good. This makes Klara very happy, but Heidi is upset and cries every night before falling asleep.
One evening, after Grandmother Sesemann has already gone back to her own house, Mr Sesemann is playing a game of chess with the doctor when suddenly, they hear the noises the servants had warned them about. The men grab their guns, thinking it may be thieves, but it turns out it's just Heidi sleepwalking. She comes down every night, opens the door, and stares at the distance before returning to her room and lying down at the end of the bed like she would do with a goat.
When the doctor checks on her and finds her freezing, Mr Sesemann looks for a blanket in the closet and finds a new pile of bread rolls Heidi has been saving. Then, Heidi wakes up, and when the doctor asks her if she's in pain, Heidi explains her chest hurts. Afterward, the doctor has a chat with Mr Sesemann in private to explain Heidi is ill with homesickness and her nerves are in quite a state, so she should be sent home.
At first, Mr Sesemann refuses, but then he spends the night thinking about what happened to his wife. The next morning, when Klara asks about the ghost, her father explains it was Heidi sleepwalking because she's suffering, which is why they'll be sending her home. Klara gets incredibly upset by this news and throws a fit, screaming a Heidi too before she leaves for her bedroom.
Heidi is happy to hear she'll go back to Alpöhi but she still worries about Klara and tries to talk to her, yet Klara won't open the door. When the time comes for Heidi to leave, the servants prepare a basket full of bread rolls and other foods she can take to the mountains. Heidi hands Mr Sesemann her wooden bird to be given to Klara and makes him promise she'll visit her one day.
After Heidi is gone, Rottenmeier points out they'll finally have peace again, but karma soon proves her wrong: there's still a kitten around the house. As Rottenmeier panics, Tinette picks the kitten up and decides to name it Heidi. As soon as she arrives back in town, the first thing Heidi does is take off her boots and reunite with Peter.
She stops by his house to say hi and drop off the food, then she runs up the mountain and, after ditching her fancy dress, she finally reunites with her beloved grandfather. Heidi easily returns to her old routine and spends her days running through the mountains while herding the goats with Peter, but there still are a few changes. She's finally allowed to go to school, so during the winter months, she and Alpöhl move with the goats to a house in town.
Her new teacher is much stricter than Klara's, and sometimes there are physical punishments for misbehaving. Her class laughs at her when she confesses she wants to be a writer when she grows up, but at least she does well in her studies unlike Peter, who still has trouble reading even when Heidi tries to help him. All the interesting things that happen, Heidi puts on letters for Klara, also saying she misses her a lot and that she should visit.
When the letter reaches Klara, it makes her feel bad because she didn't even say goodbye, so Grandmother Sesemann gathers a bunch of servants and together they take Klara up the mountain. While the girls reunite with glee, Grandmother Sesemann has a drink with Alpöhl and asks him if Klara could stay for a few days, offering to pay a fee. Alpöhl is glad to accept but turns down the money, saying Klara is a guest.
Now it's Heidi's turn to teach her friend about life in the mountains: Klara begins to wear only her underdress and eat without cluttery; she also gets to pet the goats, sleep on hay and see a shooting star. Both girls are spending all their time together and that makes Peter extremely jealous. He refuses to join their activities when Heidi invites him and he goes herding on his own because Klara can't go up there in her wheelchair and Heidi wants to stay with her.
One morning, Peter arrives before the girls are up and finds the wheelchair outside the house. His jealousy kicks in and causes him to push the chair off a cliff before he runs away with the goats. As soon as the family notices the chair is gone, Alpöhl guesses who did it, so he carries Klara on his back, and together with Heidi, they follow the usual goatherding path.
Now Klara can finally experience the rest of the mountains while Alpöhl scolds Peter for his actions and makes him watch over the girls for the rest of the day. Klara loves the beautiful view, the flowers, and the cute little butterfly that comes to rest on her foot. When the butterfly flies away, Klara is desperate to make it stay and tries to catch it, shocking everyone by suddenly standing up.
Walking is still hard for her though, so she spends the next few days practicing with the help of Heidi and Peter, who has changed his mind about her after seeing the miracle. When Grandmother Sesemann comes to pick up Klara sometime later, her son is with her and keeps angrily yelling because he dislikes the idea of his poor sick girl having been brought here. However, he changes his mind pretty quickly when Klara approaches them using her own feet.
After sharing hugs and tears, Grandmother Sesemann gifts Heidi a notebook and a pen so she can start writing stories, reminding her to ignore her classmate's mean comments because everyone should do what makes them happy. After saying goodbye to Klara with a tight hug, Heidi returns to her daily routine with Peter, but from now on, she takes her notebook with her so she can write a little every day.