Every four years, two children from the village of Gavaldon are kidnapped. They’re taken to the famed School for Good and Evil, where they are trained to be either storybook heroes or villains. The lovely but arrogant Sophie can’t wait to be kidnapped. She knows she’s princess material and has proved it through her recent string of good deeds in her village. She even stooped to befriend Agatha, the creepy girl who lives in the cemetery.
Agatha will be the perfect evil child, so Sophie does her part to see they are kidnapped together. But when Sophie’s plan succeeds and the girls are spirited away to the two-schools-in-one, they’re certain there’s been a mistake. Agatha is deposited at the School for Good, while Sophie is sent to the School for Evil. Sophie will have to learn ways to kill, uglify herself, curse others and the like. She begins a campaign to convince everyone she’s been miscategorized, but she only succeeds in annoying her three evil roommates.
Agatha, feeling out of place at the School for Good, only wants to get Sophie and break out so they can go home. But Sophie has no desire to leave. She is still convinced she can right this terrible wrong and get transferred to the School for Good. She also falls for a prince named Tedros and can think of nothing but winning him for herself. She repeatedly thwarts Agatha’s efforts to rescue her and takes Agatha’s loyalty for granted.
Although upset, Agatha continues with her studies in hopes that Sophie will change her mind. Agatha discovers she has the power to release enchanted humans from spells that have held them captive as animals or objects. Then Sophie’s flirting with Tedros begins to convince him she may be good after all, and he vows to help her prove her goodness.
The girls are brought before the School Master. He shows them that the Storian, a glowing pen that writes by itself, is creating their fairly tale at that moment. He tells them the only way they can prove who they really are is to solve a riddle. They must determine the one thing Evil can never have and Good can never do without.
Sophie’s roommates tell her the history of the school. There were once two School Masters who were twin brothers. One was good; the other was evil. The brothers ran the school and protected the Storian, ensuring the balance of good and evil. The evil brother tried to seize the Storian so he could be in control. A great war began, and one brother was killed. No one knows which brother won, but everyone suspects it was the Good brother since Evil hasn’t won a battle in years.
The girls determine that the answer to their riddle is Love. Agatha is convinced that if Sophie’s true love, Tedros, kisses Sophie, it will prove she isn’t a villain. Then they can go home. Only Sophie learns that the students at the School for Good (who are called Evers) are having a ball. She’s determined not to miss it, even if it means keeping Tedros from bestowing True Love’s Kiss upon her.
Sophie’s grades are horrible, so Agatha helps her cheat so as not to be kicked out. Agatha frequently puts a spell on herself to become a cockroach. She sneaks in to the Evil school (whose students are called Nevers) to help Sophie study. Sometimes she hides in Sophie’s hair to whisper answers to her and help her pass difficult challenges in the classroom.
Meanwhile, Sophie starts to dress in heavy makeup and short, tight dresses to get the attention of other males. She begins teaching lunchtime lectures to the girls at her school so they can grow in popularity with the Evers.
Tedros finally agrees to take Sophie to the ball, even though it goes against all the rules about Evers and Nevers remaining with their own kind. Several of the Nevers, who are convinced Sophie has been cheating on her exams and homework, plan to kill her in an upcoming challenge. A disguised Agatha saves Sophie from certain death, but Sophie’s behavior afterward puts her at odds with both Agatha and Tedros. Agatha wishes to be beautiful, and her wish comes true. Soon, she and Tedros plan to attend the ball together. Sophie then shows the extent of her evil nature by waging war against the Evers and trying to destoy Agatha, whom she now realizes is her Nemesis.
In a competition the night of the ball, students are required to demonstrate a talent. Sophie has been locked out of the room, so the students hope there won’t be trouble. Agatha can’t think of a talent. When her turn comes, she realizes that the fairy and wolf guards are actually former students who were given these bodies and guard jobs for failing their classes. She doesn’t have enough power to free their spirits, but her ability to show the other students the truth makes the current students more compassionate toward the guards.
Sophie breaks in, and using her evil magic, sends ravens to brutally destroy the wolves and fairies. She tries unsuccessfully to destroy the student body as well. Sophie soon leads the conflicted Nevers in waging a final battle against the Evers. Agatha visits the School for Evil in an effort to stop the war. When the Evers arrive to attack, Sophie tries to discredit Agatha and convince the Evers that Agatha is on Evil’s side. Evers magically become ugly, and Nevers become attractive, until no one knows who is on whose side. Sophie realizes the only way she will ever get the ending she wants is to destroy the School Master and the Storian.
The School Master, who appears as a handsome prince, tells Sophie they belong together. He reveals that he is Evil, but Good has continued to triumph all these years because Love is the most powerful force there is. He believes that with Sophie, he can find something even more powerful: Evil love. He kisses her and turns into a rotting, maggot-filled corpse.
Sophie is in despair, finally believing she can never be Good. Just then, Agatha rescues her. As the other students look on, the spirit of the School Master’s brother takes on the body of a willing teacher and destroys the Evil brother before vanishing. Agatha holds Sophie’s dying body as Sophie pants that she doesn’t want to be evil. When Agatha thinks Sophie is dead, she kisses her friend on the lips. The kiss revives Sophie, and the two friends happily vanish.