Shrek has grown steadily tired of being a family man and celebrity among the local villagers, leading him to yearn for the days when he felt like a “real ogre”. When he takes his family to Far Far Away to celebrate his children’s first birthday, a series of mishaps further injure his ego, causing him to lose his temper and walk out in anger.
Shrek encounters Rumpelstiltskin, who seizes his chance, having observed Shrek’s angry outburst. He follows Shrek and arranges for Shrek to appear to save his life. To “thank” him, he gives Shrek a day to live like a real ogre, in exchange for a day from his childhood that he would not remember being erased.
Shrek signs the contract and appears in a reality where he is feared by villagers. He takes the opportunity to cause some lighthearted mischief until he finds “WANTED” posters for Fiona and his home deserted and desolate. He is kidnapped by witches and taken to Rumpelstiltskin, now the King of Far Far Away, which has become derelict and run down.
Upon inquiry, Rumpelstiltskin reveals that the day he erased was the day of Shrek’s birth. Therefore, Shrek never saved Fiona, never met Donkey, and consequently Rumpelstiltskin was able to get King Harold and Queen Lillian to sign their kingdom away, making them both disappear. When the day ends, Shrek will disappear as well. Shrek escapes Rumpelstiltskin’s castle with Donkey. Initially terrified of Shrek, Donkey decides to trust him after seeing Shrek cry over his erased history, something he had never seen an ogre do before. After Shrek explains the situation, Donkey helps him find a hidden exit clause: the contract will be nullified if Shrek and Fiona share true love’s kiss.
They soon encounter a band of ogres who are resisting Rumpelstiltskin. The ogres are led by a still-cursed Fiona who, after escaping from the tower where she was held captive, keeps the retired and overweight Puss in Boots as a pet. Shrek does everything he can to gain Fiona’s love, but she is too busy preparing an ambush on Rumpelstiltskin. She is also bitterly cynical and disillusioned about the power of true love and throws herself into planning Rumpelstiltskin’s capture. While sparring with her, Fiona begins to like Shrek, but stops short of kissing him. Puss encourages him to continue pursuing Fiona.
During the ambush, the ogres are captured by the Pied Piper, though Shrek and Fiona escape with the intervention of Puss and Donkey. Shrek insists Fiona kiss him, saying it will fix everything, but because Fiona does not truly love him, the kiss does not work. When he hears that Rumpelstiltskin is offering the “deal of a lifetime” (where all wishes come true) to the one who brings him Shrek, Shrek turns himself in and uses the deal to free the other ogres, who then storm into the castle, battle the witches, and capture Rumpelstiltskin.
As the sun rises, Shrek begins to fade from existence. But Fiona, having fallen in love with him, kisses Shrek just before he disappears, thereby voiding the contract and restoring Shrek to his world, just before he lashed out at the party. Shrek embraces his friends and family with a newfound appreciation for everything he has, truly living happily forever after.