Act I
On his seventh birthday, two ogre parents send their son Shrek out of their house and into the world to make his living. They warn him that because of his looks, he will be shunned by the world, and an angry mob will be the last thing he will see before he dies. Some years later, an embittered, grown up Shrek is living contentedly alone in a swamp. However, his solitude is disrupted when a refugee caravan of fairy-tale creatures (Pinocchio, the Three Bears, Three Little Pigs, The Big Bad Wolf, Peter Pan, The Ugly Duckling, Fairy Godmother, Evil Queen, White Rabbit, Mad Hatter, Sugarplum Fairy, Humpty Dumpty, and Elf) show up on his property. They explain of their banishment from the Kingdom of Duloc, by order of the evil Lord Farquaad, who sentenced them into penal transportation for being freaks, under penalty of death if they ever return. Although hesitant, Shrek decides to travel to see Farquaad and try to regain his swamp, along with getting the Fairy-tale Creatures their homes back.
Along the way, Shrek rescues a talkative Donkey from some of Farquaad's guards. In return for rescuing him, and offering his friendship, Donkey insists on tagging along to show him the way to Duloc, which Shrek reluctantly agrees to, due to him being lost.
Meanwhile, in the Kingdom of Duloc, Farquaad is torturing The Gingerbread Man into revealing the whereabouts of other Fairy-tale Creatures that are still hiding in his Kingdom so he can have them arrested as well. Just as Gingy was going to reveal what he knows, the Captain of the guards arrives and announces that they have found the Magic Mirror. Farquaad asked the mirror if Duloc was the most perfect kingdom of them all. The mirror told him that he's not truly a king yet, but he can become one if he marries a princess. It shows him three different princesses to choose from: Cinderella, Snow White, and Princess Fiona; at the suggestion from his henchman, Thelonious, Farquaad chooses Princess Fiona, who is currently trapped in a castle surrounded by lava and guarded by a terrible fire-breathing dragon. Accepting this as a task, Farquaad decides to marry her to become king, and rushes out to plan a raffle to see which knight would be worthy enough to embark on a quest to retrieve Fiona before the Mirror can tell him what happens to her at night. The Mirror then shows the audience the story of Fiona's childhood.
A seven-year-old Fiona dreams of the brave knight who, as her storybooks tell her, will one day rescue her from her tower and end her mysterious curse with “true love’s first kiss”. As she grows into a teenager, and then a headstrong woman, she becomes a little bit stir-crazy, but she never loses her faith in her fairy-tales.
Shrek and Donkey arrive in Duloc where Farquaad expresses his love for his kingdom, accompanied by his cheerful cookie-cut army of Duloc Dancers. They approach Farquaad, with him being impressed by Shrek's size and appearance. Farquaad demands that Shrek must rescue Fiona, and in return, he will give Shrek the deed to his swamp.
The two unlikely friends set off to find Fiona, with Shrek becoming increasingly annoyed with Donkey as time progresses. After crossing the rickety old bridge and arriving at the castle, Shrek sets off alone to rescue Fiona while Donkey encounters Dragon who initially wants to eat him, but then decides to spare him. When Shrek finds Fiona, his lack of interest in playing out her desired, romantic rescue scene annoys her, and he drags her off by force. The two of them reunite with Donkey, and all three attempt to escape while being chased by the angry Dragon. Shrek traps Dragon and they get to a safe place.
Fiona then insists that Shrek reveal his identity and is shocked that her rescuer is an ogre and not the Prince Charming her stories indicated. Shrek explains that he is merely her champion; instead, she is to marry Farquaad. The trio begin their journey back to Duloc, but Fiona becomes apprehensive as the sun begins to set. She insists that they rest for the night and that she spend the night alone in a nearby cave. Donkey and Shrek remain awake, with Donkey asking Shrek who he would be, if he did not have to be an ogre anymore. As Shrek opens up to Donkey on who he would wish to be, Fiona transforms into an ogress as part of her curse that happens during sunset, stands apart, alone, and listens.
Act II
The next day, Princess Fiona rises early and sings with a bluebird and dances with a deer, before making the bird explode and throwing the deer off a cliff. She assists the Pied Piper in his rat-charming duties. Shrek brings down her mood by attempting to give subtle hints about her groom-to-be and mocking her tragic childhood circumstances. The two begin a contest of trying to one-up each other to outdo the others' backstory, but end up revealing their respective pasts. Both admit to being thrown out by their parents. This connection, as well as bonding over a love of disgusting bodily noises, kindles friendship.
In Duloc, Lord Farquaad is in his bathtub planning his wedding, and he reveals his own sordid heritage after The Magic Mirror insists that Farquaad should invite his father, but Farquaad refuses, explaining how he abandoned him in the woods as a child.
As Shrek and Fiona's newfound camaraderie grows into love, Donkey insists, with the help of the Three Blind Mice from his imagination, that Shrek should gather his courage and romantically engage Fiona. Shrek, finally beginning to come out of his caustic, protective shell, tries to find the words to explain his feelings to Fiona.
While Shrek is out finding a flower for Fiona, Donkey discovers that Fiona turns into an ogress at night, and she confesses that she was cursed as a child, which is why she was locked away in the tower. Only a kiss from her true love will return her to her proper form, and she asks Donkey to promise never to tell. Shrek arrives near the end of the conversation and misunderstands Fiona’s description of herself as an ugly beast, and thinks she is talking about him. Hurt by her presumed opinion, Shrek storms off.
The next day, transformed back to her human form, Fiona decides to tell Shrek about her curse. When she tries to explain, Shrek rebuffs her with his “ugly beast” overhearing, causing Fiona in turn to misunderstand. Then Farquaad arrives to claim Fiona and tells Shrek he has cleared the swamp of the Fairy-tale Creatures, and now belongs to Shrek again. While not very impressed with Farquaad, Fiona agrees to marry him and insists that they have the wedding before sunset. As Farquaad and Fiona ride back to Duloc, Donkey tries to explain the misunderstanding to Shrek (who is too angry and upset to listen), and Shrek rejects him as well, declaring that he will return to his swamp alone and build a wall to shield himself from the world.
Meanwhile, the Fairytale Creatures are on their way to a landfill which is to be their new home, since they were forced to relocate from the swamp. After dealing with the fact that Shrek broke his promise to them, however, Gingy rants that Farquaad's treatment of them is intolerable; just because they are freaks does not mean they deserve to be hated, so he rallies most of the other fairy-tale creatures into staging a coup d’état against Farquaad's rule. Unfortunately, a bitter Pinocchio (remembering they are not allowed back to Duloc), doesn't want his friends to get killed, suggesting they should just keep going, and wait until everything gets better, all the while, wishing to be a real boy. Exasperated by Pinocchio's turndown, Gingy convinces him to join the protest, inspiring him to accept who he is, as all of them have accepted who they are; they gather new confidence and strength in themselves, as they declare that they'll raise their “Freak Flag” high against their tormentors. Now realizing that they have become something more than friends, and have become a family, Pinocchio now leads his gang back to Duloc to overthrow Farquaad once and for all.
Shrek has returned to his once again private swamp, but he misses Fiona. Donkey shows up attempting to seal off his half of the swamp with stone boulders, which Shrek rebuffs. In turn, Donkey angrily berates Shrek for his reclusive and stubborn habits, even to the point of driving off Fiona. An angered Shrek reveals he heard her talking about a hideous creature the night before, and Donkey retorts that they were not talking about him, but of "someone else". When a confused Shrek inquires who it was, Donkey, wanting to keep his promise, and still crossed with Shrek, refuses to talk. When Shrek apologizes and extends his friendship, Donkey forgives him.
The two then go back to Duloc, where Shrek objects to this marriage before Farquaad can kiss Fiona, and Fiona convinces him to let Shrek speak with her. Shrek finally finds the words to express his feelings for Fiona, and he declares his love for her ("Big Bright Beautiful World (Reprise)"). However, his declaration of love is mocked by Farquaad. Caught between love and her desire to break the curse, Fiona tries to escape the event. Just then, the Fairy-tale Creatures storm into the wedding and protest their banishment. They are also accompanied by Grumpy, one of the Seven Dwarfs, who reveals that he is Farquaad's father, and he kicked Farquaad out at the age of 28 when he wouldn't move out of the basement, revealing Farquaad is a freak as well. During the scuffle, the sun sets, causing Fiona to turn into an ogress in front of everyone. Farquaad, furious and disgusted over the change, orders for Shrek to be drawn and quartered along with the Fairy-tale Creatures and Fiona banished back to her tower. As Farquaad proclaims himself the new King, Shrek whistles for the Dragon, who has now escaped the castle (and is the reason Shrek and Donkey got to the wedding just in time). Dragon then crashes through the window with Donkey and incinerates Farquaad with her fiery breath.
After Farquaad’s death, Shrek and Fiona admit their love for each other and share true love's first kiss. Fiona's curse is broken, and she takes her true form: an ogress. At first, she is ashamed of her looks, but Shrek declares that she is still beautiful. The two ogres begin a new life together (along with Donkey, Dragon, and the Fairy-tale Creatures) as everyone celebrates their liberation against Farquaad’s orders. In the end, Shrek and Fiona host their post-wedding party.