Each year, on Rapunzel's birthday, the king and queen release thousands of sky lanterns in hopes she will see them and return home. Rapunzel becomes obsessed with the distant lights, and, on the eve of her 18th birthday, asks Gothel for permission to see them closer. Gothel claims that the outside world is too dangerous and Rapunzel is too weak and young to survive in it. Later, handsome thief Flynn Rider steals Rapunzel's intended crown from the palace, abandons his partners, the Stabbington Brothers, and takes refuge in the tower. Rapunzel knocks him out and hides him in a closet. She considers showing him to Gothel as proof she is capable of taking care of herself; however, Gothel refuses to let her broach the subject, so Rapunzel sends Gothel on a three-day journey to get new paints.
Rapunzel hides the crown, not realizing it is her own, and tells Flynn he can only get it back by taking her to see the lights. Along the way, they stop at the Snuggly Duckling pub, where menacing thugs try to capture the wanted Flynn. Rapunzel soon charms them into revealing their softer sides; when royal guards arrive, the thugs help her and Flynn to escape. Meanwhile, Gothel becomes suspicious, returns to the empty tower, and finds the crown. She sets out to find Rapunzel, and allies herself with the Stabbington brothers.
In escaping from the guards, Flynn and Rapunzel become trapped in a fast-flooding cave. Thinking they will die, Flynn resignedly reveals his true name (Eugene Fitzherbert) and Rapunzel reveals her magic powers. Her glowing hair shows a previously hidden exit, and they escape and take refuge in the woods. That night, Gothel catches up to Rapunzel while Eugene is away, gives her the crown, and tells her to use it to test Eugene's loyalty.
The next morning, a palace horse named Maximus tracks down Eugene and attempts to arrest him. Rapunzel demands a truce in honor of her birthday, and Maximus reluctantly agrees, joining them as they go to the kingdom and take part in a festival in honor of the "lost princess". They spend the day celebrating with the townsfolk, then sail onto the lake to watch the solemn release of the lanterns firsthand. Having fulfilled her dream, Rapunzel gives Eugene back the crown. The two confess their love, and are about to kiss, when Eugene sees the Stabbington brothers. He walks off to apologize, and offers them the crown, but they tie him to a ship so the royal guards will arrest him and Rapunzel will think he abandoned her. They then try to capture Rapunzel, but Gothel stages a "rescue" and takes Rapunzel home.
Eugene escapes with the help of Maximus and the pub thugs. Meanwhile, Rapunzel realizes she has subconsciously incorporated the kingdom's standard into her artwork all her life; finally understanding that she is the "lost princess", she confronts Gothel. Eugene arrives at the tower, climbing up Rapunzel's hair, but then discovers her bound and gagged. Gothel fatally stabs him, and tries to drag Rapunzel to a new hiding place. Rapunzel offers to stop struggling and go willingly, if Gothel will allow her to heal Eugene. Realizing this means Rapunzel will grow old and die in Gothel's clutches, Eugene cuts off Rapunzel's hair before she can heal him. Gothel begins to age rapidly and turns to dust as she falls out of the tower.