Shrek, a green ogre who loves the solitude in his swamp, finds his life interrupted when many fairytale characters are exiled there by order of the fairytale-hating Lord Farquaad. Shrek tells them that he will go ask Farquaad to send them back. He brings along a talking Donkey who is the only fairytale creature who knows the way to Duloc.
Meanwhile, Farquaad tortures the Gingerbread Man into giving the location of the remaining fairytale creatures until his guards rush in with something he has been searching for: the Magic Mirror. He asks The Mirror if his kingdom is the fairest of them all but is told that he is not even a king. To be a king he must marry a princess and is given three options, from which he chooses Princess Fiona, who is locked in a castle tower guarded by lava and a dragon. The Mirror tries to mention “the little thing that happens at night” but is unsuccessful.
Shrek and Donkey arrive at Farquaad’s palace in Duloc, where they end up in a tournament. The winner gets the “privilege” of rescuing Fiona so that Farquaad may marry her. Shrek and Donkey easily defeat the other knights in wrestling-match fashion, and Farquaad accepts his offer to move the fairytale creatures from his swamp if Shrek rescues Fiona.
Shrek and Donkey travel to the castle and split up to find Fiona. Donkey encounters the dragon and sweet-talks the beast before learning that it is female. Dragon takes a liking to him and carries him to her chambers. Shrek finds Fiona, who is appalled at his lack of romanticism. As they leave, Shrek saves Donkey, caught in Dragon’s tender clutches, and forces her to chase them out of the castle. At first, Fiona is thrilled to be rescued but is quickly disappointed when Shrek reveals he is an ogre.
As the three journey to Duloc, Fiona urges the two to camp out for the night while she sleeps in a cave. Shrek and Donkey stargaze while Shrek tells stories about great ogres and says that he will build a wall around his swamp when he returns. When Donkey persistently asks why, he says that everyone judges him before knowing him; therefore, he feels he is better off alone, despite Donkey’s admission that he did not immediately judge him when they met.
Along the way, Shrek and Fiona find they have more in common and fall in love. The trio is almost at Duloc, and that night Fiona shelters in a windmill. When Donkey hears strange noises coming from it, he finds Fiona turned into an ogre. She explains her childhood curse and transforms each night, which is why she was locked away, and that only her true love’s kiss will return her to her “love’s true form”. Shrek, about to confess his feelings for Fiona with a sunflower, partly overhears them, and is heartbroken as he mistakes her disgust with her transformation to an “ugly beast” as disgust with him. Fiona makes Donkey promise not to tell Shrek, vowing to do it herself. The next morning, Shrek has brought Lord Farquaad to Fiona. The couple return to Duloc, while a hurt Shrek angrily leaves his friendship with Donkey and returns to his now-vacated swamp, remembering what Fiona “said” about him.
Despite his privacy, Shrek is devastated and misses Fiona. Furious at Shrek, Donkey comes to the swamp where Shrek says he overheard Donkey and Fiona’s conversation. Donkey keeps his promise to Fiona and tells Shrek that she was talking about someone else. He accepts Shrek’s apology and tells him that Fiona will be getting married soon, urging Shrek into action to gain Fiona’s love. They travel to Duloc quickly, thanks to Dragon, who had escaped her confines and followed Donkey.
Shrek interrupts the wedding before Farquaad can kiss Fiona. He tells her that Farquaad is not her true love and only marrying her to become king. The sun sets, which turns Fiona into an ogre in front of everyone in the church, causing a surprised Shrek to fully understand what he overheard. Outraged by Fiona, Farquaad orders Shrek killed and Fiona detained. Shrek whistles for Dragon who bursts in along with Donkey and devours Farquaad. Shrek and Fiona profess their love and share a kiss; Fiona is bathed in light as her curse is broken but is surprised that she is still an ogre, as she thought she would become beautiful, to which Shrek replies that she is beautiful. They marry in the swamp and leave on their honeymoon while the rest celebrate by singing “I’m a Believer”.