Centuries ago, men created "Incarceron," a separate world in which criminals were imprisoned with enlightened men. The hope was that those who had more restrained and scientific minds would positively influence the inmates until life inside the prison evolved into utopia. Unfortunately, the experiment failed. Incarceron has become a living entity keeping watch over a society where the violent hold power and the citizens cling to legends of a world of stars and fresh air.
Finn, a teenager who remembers little before coming to consciousness within the walls of the prison, allows himself to be tied to the rails of a train in order to entrap and rob members of the Civicry, a rival society inside Incarceron. When the Maestra, a young woman, offers to free Finn from his chains, she notices the mark on his arm of an eagle with a crown around its neck. She mentions it looks like the markings within a crystal she’s seen. Finn, hoping she might have some clues to where he came from, warns her of the coming raid, but it is too late. The members of his group, The Comitatus, attack the Civicry. They steal food and throw it down chutes toward their own section of the prison. Finn manages to find the Maestra in the chaos and takes her as a hostage back to his home.
Those outside of Incarceron have been kept within their own prison over the years, a prison of protocol. Because the creators of Incarceron believed that technology led to the problems of society, they demanded that people live within the societal constraints of the 18th century. Houses, clothes, transportation and medicine have been forced back to that more primitive century — although the people know it’s all make believe. Claudia, the daughter of the Warden of Incarceron, is frustrated by the limitations imposed on her by this society and fights to learn all she can from her tutor, Jared, before she is forced into an arranged marriage with the prince of her country.
Finn and his oathbrother, Keiro, must appear before Jormanric, the leader of the Comitatus. Jormanric wants to kill the Maestra and keep her soul entrapped in one of his skull rings so he can use it when his life is threatened. Gildas, a descendant of the Sapienti — the wise men who hoped to enlighten the first criminals of Incarceron — convinces Jormanric to allow Finn to keep the woman for a time so they can demand a ransom from her people.
Jared tells Claudia that he suspects her first fiancé, Prince Giles, was murdered so that his half-brother, Prince Casper, would inherit the throne. They don’t have much time to investigate Jared’s theory as Casper has been expelled from school and the Queen has insisted he marry Claudia immediately. Claudia believes her father’s study may hold clues as to what happened to Giles. If nothing else, she wants to steal inside the room to learn more about Incarceron.
Finn attempts to win the Maestra’s trust. He admits that he appears to be a "cell born," someone that Incarceron created by using pieces of deceased people. Finn can remember nothing until a few years ago when he woke up in a cell. His name and prisoner number were pinned to his clothes, but he had no recollection of existing before that time. Even now, he has no clue as to his identity, but occasionally he blacks out and remembers random images from a place far different than the prison. Finn explains that Gildas and Keiro saved him from death. Keiro and Finn are oathbrothers and have vowed to protect each other. If one of them is killed, the other must avenge his death. Gildas believes Finn’s few memories are actually messages from Sapphique, a man of legend and the only person to have escaped from Incarceron. Finn begs the Maestra to tell him of the crystal she's seen, and she agrees after he promises to help her escape back to the Civicry. The Maestra tells him of a crystal cylinder her people found in a bricked up portion of the prison. A hologram inside looked just like the mark on Finn’s arm.
Jared has developed a hologram of Claudia that she uses to convince her servants that she is in her room. While her father is gone for the afternoon, she breaks into his study. She has only a few minutes inside the room, but she manages to steal what she believes is her father’s key to the prison, but she has no idea of the location of the door.
The Maestra’s people must bring a ransom equal to her weight before Jormanric will release her. Finn and Keiro watch as her people load treasure onto a scale. They give everything they have in order to make the proper weight. Finally, they give up the crystal Finn wants. As the Maestra is released, she curses Finn for betraying her trust. She will never be able to show kindness to a stranger again because of what he’s done. She curses him and the crystal and hopes it destroys him. As she turns to leave, the chain bridge she’s on collapses, plunging her and her people into a burning abyss. Finn realizes, before he succumbs to one of his blackouts, that the crystal is some kind of key. He dreams of Sapphique, the only man to have escaped the prison. When he wakes up, Keiro chastises him for being angry about the Maestra’s death, telling Finn that there is no room for mercy or honesty in Incarceron. Finn reveals his dream to Gildas who insists it’s a sign that they should escape the Comitatus.
Lord Evian, a member of the Steel Wolves, confesses a plan to assassinate the prince to Claudia. The Steel Wolves are a group who long for a leader who will let them live normally, not trapped in the restraints of the 18th century. They hope Claudia might aid their plan and become the ruler of the land.
Finn, Keiro and Gildas try to sneak away but are confronted by Jormanric and the Comitatus. A brutal fight ensues. Keiro stabs Jormanric through the hand, pinning him to the floor. He steals three of Jormanric’s magical rings before the prison starts a lockdown. As Finn flees to safety, Jormanric accuses Keiro of being behind the Maestra’s death. Finn and the others manage to escape, but have picked up a new friend — a slave that has been treated like a dog. Keiro insists they leave the creature behind, but Finn carries the slave on his back.
Claudia and Jared examine the crystal key she stole from her father’s study. They hear the voices of Finn and the others. Claudia is confused because the voices sound frightened. She wonders why people in a perfect world would be scared. Her father arrives and informs Claudia that her fiancé is waiting for her. As they walk back together, Claudia admits that she broke into his study, but not that she stole the key. Her father praises her ingenuity, saying it will come in handy when she is living with the Queen.
Finn and the others enter a new section of Incarceron. He discovers the slave he helped is actually a young girl named Attia. She vows to follow him because he saved her and she wants to see the Outside. Finn examines the crystal key when everyone else is asleep. The cylinder becomes a kind of walkie-talkie between Incarceron and the Outside world. Finn begs for Claudia’s help to escape as the link between them dies. Claudia still cannot understand why someone would want to leave paradise.
Claudia learns more about Prince Giles’ death, including that a former teacher of his laughed when he saw his body, as if he’d heard a joke. The teacher now lives as a hermit. Claudia and Jared discover him dead when they go to speak with him, but find a journal he left behind testifying that Prince Giles was not the boy who died in the palace. The next time she uses the key to speak to Finn, they are able to see each other. Claudia is sure that Finn is really Prince Giles, but Jared is not convinced.
After Keiro poaches a sheep, Finn and Gildas are taken prisoner, but Keiro and Attia escape arrest. Keiro takes the key for safekeeping and gives Finn one of the skull rings for protection. Finn and Gildas are sentenced to face the Beast. For centuries people have been sacrificed monthly to it. No one but the mythical Sapphique managed to escape death, but he had to give it one of his fingers. Gildas and Finn are thrown into a cave to conquer the Beast or die. They discover the cave itself is really the Beast, the mind of Incarceron. The prison has fed off the bodies, souls and machinery of its inhabitants for years. It demands that Finn sacrifice Gildas if he ever hopes to escape, but Finn offers it one of the skull rings instead.
Claudia has travelled to the royal palace so her wedding can take place. The Queen guides her to her new rooms and tells Claudia she intends for her to be the true ruler of the kingdom. Casper will be a figurehead. Claudia is stunned, but summons enough courage to ask that her tutor be allowed to stay at the palace. At first the Queen refuses, but Claudia insists. Meanwhile, Jared is able to make contact with Keiro. He tells the boy of a code that will shut down the scanners inside the prison.
Keiro and Attia enter the Beast’s cave to rescue Finn and Gildas. They use Jared’s code. Incarceron can no longer see them, but it can feel them as they struggle to find their way out. Keiro returns the crystal key to Finn. It heats up, and he uses it to melt the rock around them so they can escape. As the Beast dissolves around them, they pull themselves out onto solid ground. An ancient ship, one that sails through the air, waits to take them to safety.
Claudia is speaking with her father when an alarm on his watch sounds. When questioned, he admits it has something to do with Incarceron. She secretly follows him through the hallways of the palace to the wine cellar. Hidden behind some casks, she watches as he enters a code; a massive iron gate swings open. She rushes back to tell Jared she’s found the entrance to the prison.
Finn and his companions are introduced to Blaize, a Sapienti like Gildas. Blaize welcomes them to his Sapienti tower where he has collected all kinds of plants and animals that he keeps in glass cages. Blaize tries to convince the others that there is no outside world and that Incarceron is all that exists. The stories of Sapphique and another world are just myths. Finn argues that they’ve spoken to Claudia and Jared, people outside of the prison. Blaize leaves the room before the others use the crystal to call to Claudia. When they make contact, Claudia convinces them that she does indeed live outside. She also says she’s found the gate to the prison. Gildas questions Jared about what happened to Sapphique once he escaped, but to his dismay, Jared has never heard of the legendary Sapienti who made it to the outside world. Claudia vows that she will enter Incarceron and guide them out. Lord Evian of the Steel Wolves overhears much of their conversation. He believes that Finn, even if he isn’t Prince Giles, can still be used as a figurehead to overthrow the Queen and Prince Casper. Claudia makes him swear not to kill her father in the coup, and he does so, as a lord of the kingdom and a follower of the nine-fingered-one. After Evian leaves, Jared and Claudia wonder about the identity of the nine-fingered-one.
Attia finds volumes in Blaize’s library that hold a visual history of every prisoner’s life. Finn’s name is found, but no pictures of him as a child. Attia claims not to find any pictures of Claudia, which reinforces their belief that she is outside Incarceron. Later, as they sit down to a meal, Attia insists on tasting Finn’s food before he eats. She falls to the ground as poison courses through her body. Finn makes Keiro give up one of his skull rings. After Finn places it on her finger, she begins to get better.
Keiro finds a way out of Blaize’s tower. Finn and his companions steal Blaize’s ancient sailing ship and fly away. For a while they travel in calm weather, but then enter a storm that threatens to dash them to the ground. A giant eagle comes out of the clouds and tries to steal the crystal key, but it fails. Finn uses the key to call to Claudia, begging her to get her father to stop the storm, but she knows he won’t. The Warden knows Claudia has the key and has threatened Finn’s and Jared’s lives if she doesn’t return it. Her father does not believe Finn is Prince Giles and tries to convince Claudia of the same. Finn and the others come to a vast wall, the end of their world. They manage to steer the ship to a small opening where they come to rest.
Jared has discovered that Incarceron exists in another dimension of space. The Sapientis of old figured out how to change peoples’ molecular structure so they could shrink them down to their atoms. Before he leaves to attend Claudia’s wedding, he tells her there is no way to get Finn out because they no longer have the technology to reverse the process. Claudia uses the key to tell Finn the bad news. The others don’t believe her, and Attia confesses that back in Blaize’s tower she discovered Claudia had been born in Incarceron, but someone took her out when she was a week old. She is not the Warden’s biological daughter.
Jared returns, having found out the nine-fingered man Evian spoke of was named Sapphique. Now they know that it is possible to enter Incarceron and return. Claudia vows again to find them and get them out. She and Jared return to her father’s study. They have figured out that the Warden’s chair is a kind of transporter. Claudia sits in it while Jared finds the controls. She disappears, and Jared makes his way back to the wedding ceremony before he is discovered. Claudia’s maids find her torn wedding dress and bring it before the queen. When questioned, Jared confesses that Claudia has fled the castle rather than marry Casper. Lord Evian, desperate that the Steel Wolves’ plan to overthrow them is fulfilled, tries to assassinate the queen. He only wounds her and must kill himself before he is tortured for information.
Claudia finds herself inside Incarceron. The prison speaks to her, promising to take her to Finn. As she searches, Finn and the others try to outsmart Incarceron. They are still invisible to it, having used Jared’s code, but it catches them by making its walls magnetic. Gildas and Attia pry off Finn’s sword and help him detach the key from his belt so he can be released from the wall, but Keiro is stuck. He is one of the halfmen, people created by Incarceron from not only organic material but trash as well. He has known it all his life, but admitted it to no one. He also has no idea how much of him is human and how much is machine. Finn pleads with the prison, and it finally releases Keiro.
The Warden questions Jared about Claudia’s whereabouts. Jared admits she went to the prison. The Warden confesses the Queen blackmailed him into helping her get rid of Prince Giles so that her son could be King. She threatened to tell the world that Claudia was not his daughter, but a child of Incarceron. The Warden also shows Jared his pocket watch from which dangles a small cube. The cube is actually the world of Incarceron.
The two men venture to the Warden’s study where they use the cameras inside the prison to locate Claudia. She has found Finn and his friends but realizes she doesn’t know how to get them out; there is no portal inside Incarceron. The Warden appears as a hologram in the wall, and the others recognize him as the Sapienti Blaize. He informs them that the keys themselves are portals, but they can only transport one person at a time. Keiro and Finn battle for the key, but Keiro gets it first. When he tries to go, the portal fails. The Warden tells him it’s because of Keiro’s metal parts. What was made in Incarceron must stay in the prison. The Warden tells Claudia that the Queen’s guards are at the door, ready to take him prisoner. Claudia and Finn must escape. Even if Finn isn’t Prince Giles, he must pretend to be or they all will be killed when they return.
Incarceron terminates communication between the worlds and causes an earthquake in the prison. Finn tries to get Claudia to take Gildas back with her. The Sapienti has been mortally wounded, and Finn hopes he can be healed in her world. Gildas refuses to go, but asks Finn to show him the stars. Finn allows himself to be pulled into a vision and takes Gildas with him. The Sapienti dies, and Finn awakens from his dream. Before he transports away, he swears to return for Attia and Keiro. Claudia returns directly to her father’s study, but Finn is sent to face Sapphique. The mythical man tells Finn he is bound to Incarceron and calls forth the figure of the Maestra. Finn admits that it was his fault that she was killed and apologizes. She tells him to remember his mistake. Sapphique asks if she would have Finn be kept in Incarceron, but she says she has no need of payment for her forgiveness. With that pronouncement, Finn is hurtled through the portal and sent to the Warden’s study.
The Warden opens the door to the Queen and her guards. He points out Finn. With a touch of a button, the Warden announces he and the Queen sought to protect Prince Giles from assassins, but now that Lord Evian is dead, they have brought him back. The Queen is furious, but agrees to the lie. The Warden takes the crystal keys and sits in the chair that is the portal to Incarceron. In an instant he disappears into the prison. Finn is distraught because now there is no way to return for Keiro and Attia. Claudia promises that Jared and the other Sapienti will work tirelessly until another way is found into Incarceron. She notices that her father left his pocket watch with Jared. When Finn begs to know where Incarceron is, Jared looks at the tiny cube dangling from the watch’s chain and tells him it is closer than he thinks.