The movie begins with Flynn Rider (Zachary Levi) narrating, explaining how hundreds of years ago, a single drop of sunlight fell to Earth and bloomed into a magical golden flower. The flower is found by an old woman named Mother Gothel (Donna Murphy), who sings the song "Healing Incantation" to it, causing it to restore her youth and beauty. In this way she lives for hundreds of years, keeping the flower hidden and never sharing it with anyone.

Flynn goes on to tell how the king and queen of the land sent out a flying lantern in honor of the child they were expecting, but the queen became very sick, and the king sent out his people to search for the legendary golden flower. Gothel sees them looking and hides the flower under a false shrubbery, but knocks it away by accident when fleeing, causing its glow to be visible in the darkness. The king's guards uproot the flower and take it to the palace, where it is fed to the queen, who survives and gives birth to a daughter, Rapunzel. The little princess has beautiful golden hair that glows with the magic of the flower.

That night, an already-aging Gothel sneaks into the palace and cuts a piece of Rapunzel's hair to use instead of the flower. When she cuts it, though, both the hair she cut and the lock she cut it from turn dark brown. Gothel realizes that cutting Rapunzel's hair causes it to lose its power, and so she kidnaps the princess, escaping out the window with her. Flynn's narration explains that she locked her away in a hidden tower and raised her as her own child, having Rapunzel sing the healing song to restore Gothel's youth. Every year afterwards, on the princess' birthday, the kingdom would release hundreds of flying lanterns as a symbol of hope that the lost princess would return to them.

Eighteen years later, we cut to an older Rapunzel (Mandy Moore), who still lives in the tower with her only friend, a chameleon named Pascal. Rapunzel is cheerful but clearly bored with her dull life, which she describes in the song, "When Will My Life Begin?" Her hair has grown to be seventy feet long and extremely strong, and she loops it through a system of pulleys and hooks to hoist herself up and get around the tower. One of the things she does to occupy her time is painting, and her entire tower room is covered in pictures that she's drawn. One of the pictures she paints is of herself looking up at hundreds of glowing lights, which are the lights she sees in the sky every year on her birthday. She tells Pascal that today is the day and she's finally going to do it.

Outside, Gothel has arrived at the base of the tower, and she calls up to Rapunzel to let down her hair. She has Rapunzel loop her hair to make a sling to pull her up in, and proceeds to emotionally abuse Rapunzel, putting her down and making fun of her and then laughing it off. Rapunzel believes Gothel is her real mother and loves her, but Gothel clearly only cares about her magical hair.

Rapunzel says that her birthday is the next day and that what she really wants is to go see the lights in the sky, because she believes that they're connected to her somehow. Gothel tells her they're just stars and gets angry at her for wanting to go out, and sings, "Mother Knows Best", a song about how the world is a horrible and dangerous place and she only wants to protect Rapunzel, who is too stupid and helpless to defend herself. She ends the song by telling her harshly to never ask to leave the tower again, and Rapunzel agrees, her earlier courage having faded. Gothel leaves.

Meanwhile, Flynn is sneaking across the palace roof with two other thieves, the twin Stabbington Brothers (Ron Perlman). They lower Flynn in through the roof and he steals the crown of the lost princess, although he is seen and they end up being chased out of the palace and through a forest. They find a tree covered in wanted posters of the three of them, and Flynn takes one and acts upset, but it turns out to have been only because his nose was drawn incorrectly. Still being chased, they reach a steep wall that appears to be a dead end, and Flynn tells the twins to give him a boost over the wall. They suspect he's just going to run off with the crown and leave them to be caught, but he convinces them to trust him -- and then does exactly that. Flynn then runs through the forest being chased by both the guards and the twins, as well as the leader of the guards' horse, Maximus. Maximus has an elevated sense of smell and can track Flynn by scent, and catches up to him even when he outruns the others. In the resulting struggle, the satchel with the princess' crown inside of it nearly falls over a cliff, catching at the last minute on a branch sticking out of the side of the cliff. In trying to retrieve it, Flynn and Maximus both fall off the cliff.

They're unhurt, but Flynn still has to escape Maximus. He finds what appears to be a rock wall, but turn out to just be a very thick curtain of vines covering the mouth of a small cave. He uses the cave to hide while Maximus searches outside, and then escapes through the tunnel, ending up in a small clearing...with Rapunzel's tower standing in the center. Deciding that it looks like a perfect place to hide, he scales the side using arrows, and ends up right in Rapunzel's bedroom. He opens his satchel to look at the crown he just got away with...right as Rapunzel hits him in the back of the head with her frying pan, knocking him out.

Rapunzel has never seen anyone other than Gothel before, and at first she's convinced he's one of the monsters her mother said lived outside the tower. Once she realizes that he's just another person, she hides him inside of her wardrobe, with some difficulty. After she finally gets him stuffed inside, she finds his satchel with the lost princess' crown, although she has never seen a crown before and doesn't know what it is. She tries to wear it in a few different ways before setting it on her head, just as she hears Gothel calling to her from outside. She hides the crown and satchel, and brings Gothel up the tower.

She plans on showing Flynn to Gothel as proof that she's not helpless and should be allowed outside, but she starts out by mentioning their conversation from earlier and Gothel flips out and screams at her that she is never leaving the tower, ever. Rapunzel realizes there's no way Gothel will ever let her leave, so she tells her instead that she changed her mind about what she wants for her birthday, and asks for paint made from white shells. Gothel really doesn't want to give her that, because the shells are three days' travel away, but she thinks it will keep Rapunzel from asking to leave and so she agrees.

Once Gothel has set out, Rapunzel takes Flynn (still unconscious) out of the wardrobe and uses her hair to tie him to a chair. Pascal wakes him up by sticking his tongue in his ear, and Flynn, not seeing Rapunzel at first, immediately freaks out. When she steps into view, however, he realizes that she's beautiful and starts hitting on her, much to her confusion. She assumes he's there to kidnap her and steal her hair, but he has no idea what she's talking about. When she realizes he's telling the truth (after whacking him with the frying pan a few more times), Rapunzel decide that this is her chance, and she forces Flynn to agree to her deal -- they'll leave the tower together, and he'll take her to see the floating lights the next night, then bring her back home the next day before Gothel returns. In exchange, she promises to give him back the crown and let him leave, and says that she never, ever, EVER breaks her promises. Flynn doesn't know why the lanterns are so important to her, but it's the only way to get the crown back, so he agrees.

Flynn gets down the tower wall the same way he got up, and calls for Rapunzel to come down. Rapunzel, taking her frying pan for protection, uses her hooks and pulleys to lower herself down on her hair, though she begins to have doubts once she's actually outside. She alternates between running around and screaming for joy, and wallowing in crushing despair and guilt for betraying her mother. Flynn is exasperated but tries to encourage her guilt, thinking that he can get her to give up and go back to the tower, and he can get away without having to take her to see the lanterns. He suddenly has an idea and says he'll take her to lunch, and drags her out of the clearing.

Elsewhere, Gothel hasn't gotten very far before she runs into Maximus, still searching for Flynn. She recognizes him as a horse from the palace, but without a rider. Suddenly suspicious, she runs back home and calls for Rapunzel, with no answer. She digs out the bricked-up door and runs up to discover that Rapunzel is gone. In a rage, she also discovers the crown Rapunzel had hidden, along with the wanted poster that Flynn had taken earlier. She assumes that Flynn has kidnapped Rapunzel, so she grabs a knife and sets out after them.

Meanwhile, Flynn has taken Rapunzel to a pub with a sign outside that says "The Snuggly Duckling". Rapunzel is excited -- she does like ducklings! -- but when they actually enter, she sees that the pub is full of angry tough-looking men. Flynn lies and tells her that this is considered a five-star establishment in the real world, trying to scare her into going back to her tower, but before they can leave Flynn is recognized from his wanted posters. One of the thugs is sent to fetch the guards while the rest of them leap on Flynn and fight over who should get the reward money. They look like they're going to tear him apart when Rapunzel hits the hook-handed one in the face and demands that they let him go because she needs him to fulfill her dream of seeing the lanterns. She implores them to find their humanity and asks if they've ever had a dream.

The Hook-Handed Thug (Brad Garrett) looks like he's going to kill her, but instead he admits that he too has a dream -- to be a concert pianist. This kicks off the song, "I've Got a Dream" admist the entire pub, where we find out that although the thugs are a cruel and bloodthirsty bunch, they also dream of true love, enjoy sewing and baking, and making tiny ceramic unicorns. One of them does miming in his spare time. Flynn is forced to join in and sings that his dream is to retire with tons of money on a sunny island somewhere with no one else around. Rapunzel gets excited and joins in too, singing about how happy she is that she left her tower and how she never wants to go back.

Unfortunately, she sings this line right as Mother Gothel looks in the window. Gothel is furious, but before she can do anything, the thug who went to get the guards returns. The guards are right behind him, with the Stabbington twins in chains. Now that they've bonded, Hook-Handed Thug decides to help them escape, and he opens a secret tunnel in the bar floor for Rapunzel and Flynn to flee through. Although they seem to escape without a problem, Maximus enters the pub and tracks Flynn's scent to the secret tunnel. The guards give chase, while outside, Gothel threatens one of the pub thugs with her knife to tell her where the tunnel lets out. The Stabbington twins also give chase, having escaped their chains.

The tunnel leads over a dam, where Rapunzel and Flynn appear to be cornered, until Rapunzel uses her hair to swing across to a ledge. She leaves Flynn her frying pan, and he uses it to fend off the guards and swordfight with Maximus, while declaring that this is the strangest thing he has ever done (and it is a pretty strange scene). Rapunzel lassoes him with her hair and pulls him off as Maximus kicks against a beam, breaking the dam and causing a huge flood of water to come crashing down on everyone.

Rapunzel and Flynn try to outrun the wave and hide in a small cave, which a falling rock blocks the entrance to. The water slowly fills up the cave as they realize it's a dead end and there's no escape. They try to pull at the rocks to no avail, and Flynn only manages to cut his hand. They both try to look for an escape under the rapidly-rising water, but there's no light in the cave and they can barely see each other above it. As they think they're about to die, Rapunzel cries and apologizes to Flynn for dragging him into this, and Flynn admits that his real name is Eugene Fitzherbert, because he thought someone should know before he died. Rapunzel tries to make him feel better by admitting that she has magic hair that glows, only to realize that they can use her hair to search for escape in the dark water. She sings the magic song just as their air pocket disappears, and they end up underwater, where Rapunzel's hair illuminates the cave.

Flynn/Eugene freaks out about her hair, but sees it drifting towards a small opening in the rocks, indicating an air current. They quickly dig their way through and are just about to run out of air when they break through to the outside, the landing in a river. They drag themselves up onto the bank, where Flynn proceeds to really flip out about Rapunzel's hair being magic.

Meanwhile, Gothel is waiting at the tunnel exit for them, but instead of Rapunzel and Eugene, she gets the Stabbington twins. She gives them the princess' crown but tells them that she could give them something worth one thousand crowns, and that they can take revenge on Eugene while they're at it.

Back with the other two, Eugene is still shocked about Rapunzel's hair, so she tells him that's not all it can do and, after making him promise not to freak out, wraps her hair around his injured hand and sings the healing song. Eugene tries very hard not to freak out but is still really weirded out when his injury disappears completely. Rapunzel explains to him that Gothel told her when she was young, people tried to cut off her hair and steal its magic. She shows him a short lock of brown hair by the nape of her neck -- the lock that Gothel cut when she was a baby -- and says that when her hair is cut, it loses all of its power. Gothel told her the reason she locked her away from the outside world was to protect her from the people who wanted to steal her hair.

Having given Eugene her background story, she wants to know his too, but Eugene says there's not much to tell -- he was an orphan who became a thief and changed his name to Flynn Rider after the hero in a book. He leaves to get firewood...and then Mother Gothel appears behind Rapunzel and tells her to come back to the tower. Rapunzel tells her she wants to stay with Eugene, because she likes him and thinks he likes her too. Gothel gets angry and tells her that she's invented the whole romance and that there's no way Eugene could possibly like her. She gives her the satchel with the crown in it and tells her that's the only thing he wants, and that the minute he gets a chance to take it he'll leave her behind. Rapunzel says she's going to give back to him right then to prove that he won't, and Gothel leaves just as Eugene returns with firewood. Rapunzel starts to give him the satchel, but begins to doubt herself at the last minute, and hides it from him.

The next morning, the two of them wake up to find a dripping-wet Maximus standing over them. Maximus attacks Eugene, but Rapunzel manages to calm her down and begs Maximus to leave him alone for just one day, so he can take her to see the floating lanterns. Maximus is charmed by her, and when she mentions that it's her birthday, he gives in, although he doesn't like it and continues to antagonize Eugene when she isn't looking. They all head out to the island city the palace is in, where Rapunzel gets her first taste of being in a crowd; she keeps bumping into people, and Eugene has to convince some little girls to do Rapunzel's hair up in a braid so she can move around without people stepping on it. Once that's over with, they go around the city, waiting for night to fall. Rapunzel has the time of her life, dancing around and drawing on the street in chalk. As a momento, Eugene buys her a little purple flag with the royal crest on it. As dark begins to fall, they leave Maximus with some apples and Eugene takes her out on the water in a boat so she can get the "best view" of the lanterns.

The king and queen, still heartbroken over their lost daughter after all these years, set out the first lantern, and then everyone in the city does the same. The lanterns float out over the water, and Rapunzel and Eugene are soon surrounded by hundreds and hundreds of beautiful glowing lights. They set off two of their own while singing, "I See the Light", a song about how they're beginning to realize their feelings for each other. Rapunzel finally gives Eugene the satchel with the crown, and he reassures her that he won't leave her. He's leaning in to kiss her when he catches sight of the shore behind her, and sees the Stabbington twins, who turn and walk off. He doesn't tell Rapunzel what's going on, but he brings the boat up to shore, tells her he'll just be a minute, and goes off with the crown.

He finds the twins, gives them the crown, and apologizes (albeit in a snarky way) for backstabbing them earlier. Instead of accepting the crown, the twins say they'd rather have the girl -- Gothel has told them all about Rapunzel's magical hair. Back on shore, Rapunzel is getting worried at how long Eugene is taking, when she sees a silhouette coming out of the fog. She assumes it's him and jokingly says she was afraid he was going to take the crown and run -- then the twins emerge from the fog and tell her he did exactly that. They point out a boat heading towards the city with Eugene at the wheel. Rapunzel runs from them, but her braid catches on a branch and she's unable to escape. When they don't come after her, she finds that Mother Gothel has appeared and hit them with a heavy branch, knocking them out from behind. She's obviously double-crossed them so she can look like she's saving Rapunzel, but Rapunzel doesn't know that. Heartbroken from Eugene's supposed betrayal, she lets Gothel take her home.

Meanwhile, the boat with Eugene in it reaches the city dock. Eugene is tied to the wheel with the crown in his hand, so that he would be unable to escape while his silhouette would appear to Rapunzel that he was steering the boat. He is arrested and thrown into prison, facing a sentence of death.

Back at the tower, Rapunzel is laying on her bed, miserable, while Gothel is just happy that things will now go back to the way they were. While she makes dinner, Rapunzel pulls out the little flag Eugene had bought her, and looks at the sun-shaped royal crest. Suddenly she realizes that the same shape is all over her tower walls -- all of her paintings incorporate it somewhere. She has a hazy memory of the shape on a mobile over her crib, of her parents' faces, and of the familiar feeling she'd had when she wore the princess' crown. She realizes that she is the lost princess, and that Gothel has lied to her this whole time. She storms out of her room and she and Gothel fight, but this time Rapunzel refuses to back down. Furious, Gothel tells her that if she wants her to be the bad guy, then she can be the bad guy.

Back in the city, Eugene is taken out of his cell to be hanged for his crimes. As they take him down the hallway, he happens to see the Stabbington twins in a cell -- they were caught after being double-crossed by Gothel. He knocks away the guards and demands that the twins tell him what happened to Rapunzel, and they tell him the old woman (an aged Gothel) took her. Realizing that she's in danger, Eugene tries to escape, but more guards come in and subdue him. They drag him out towards the gallows, but along the way, he catches sight of a tiny ceramic unicorn in a little alcove on a wall. Suddenly the doors slam shut behind and in front of them, and the thugs from the Snuggly Duckling appear to help Eugene, fighting away the guards. They get him out to the courtyard, and using a wagon to catapult him over the jail wall, where he lands on Maximus' back. It turns out Maximus was the one who went to get them, and he will help Eugene find Rapunzel instead of arresting him. They leap off of the palace roof and set off for the tower.

When they reach the tower, Eugene stands at the base and calls up for Rapunzel. Just as he starts to climb up himself, Rapunzel's hair comes tumbling down, and he uses it to climb up. When he reaches the top, though, he finds Rapunzel chained and gagged, and Gothel appears behind him and stabs him in the back with her knife. During the struggle, Rapunzel's mirror falls over and shatters into pieces. Gothel kicks open a secret passage and begins to drag Rapunzel out of it, telling her that she's going to take her somewhere where no one will ever find them ever again. Rapunzel gets the gag off and says to Gothel that she will fight her every day for the rest of her life -- but if she lets her use her hair to heal Eugene, then she will go with Gothel quietly, and do whatever she says, and never try to escape. A bleeding-out Eugene protests, but Rapunzel doesn't back down.

Gothel finally agrees and chains Eugene up, too, in case he tries to fight again after being healed. Although he's still protesting and telling her not to throw her life away like this, Rapunzel starts to wrap her hair around his wound in preperation to heal him. He leans in like he's going to give her a last kiss, but just before he does, he cuts off her hair off with a shard of the broken mirror. Her hair instantly "dies" and turns brown, and Gothel screams and tries to gather up the rest of the hair, but it's all lost its power. She begins to age rapidly, and pulls her hood down over her face so no one will see her without her youthful beauty. She can't see where she's going, though, and stumbles blindly around the room; Pascal (who's been in the movie the whole time but hasn't really done anything) uses Rapunzel's cut-off hair to trip her and send her tumbling out the window, where she dissolves into dust on the way down.

Meanwhile, Rapunzel is trying to heal Eugene anyway, although with her hair cut the magic won't work. He stops her and tells her that she was his new dream, and she tells him that he was hers. As Eugene dies, Rapunzel sings a longer version of the healing song, "The Tear Heals". As she sings, she weeps onto Eugene's face; her tear is absorbed into his skin, and begins to glow. Light shoots out from where she cried onto him, and he wakes up again, healed. He tells her he's always had a thing for brunettes, and they finally kiss each other.

At the palace, a guard runs into the room where the king and queen are to tell them that the lost princess has finally been found. They run out to the balcony, where a short-haired Rapunzel and Eugene are waiting. Rapunzel and her parents share a tearful hug, and as Eugene watches, they drag him into it, too.

Eugene narrates the ending, explaining how Rapunzel ruled the kingdom as wisely and benevolently as her parents had, and after years and years of asking, he finally agreed to marry her. Rapunzel's voice cuts in and corrects him, and Eugene admits that it was he who actually asked her. The movie ends on a shot of floating lanterns surrounding the palace, and everyone living happily ever after.