The film opens with a man, Alderson (Julian Richings), waking up in a cube-shaped room with glowing, computer circuit-like walls and six doors, one at the center of each wall, ceiling and floor. After recovering from his confusion, he opens two of the doors and looks into them to find rooms that differ to the one he is in only by color. He then opens and goes through a third door. He looks around and then takes a step, but is suddenly cut into large square-shaped pieces. He falls apart and the rack of crosshatched wires which diced him moves into view. It folds up and retracts.
Later, in another room, several people find each other: Quentin (Maurice Dean Wint), Worth (David Hewlett), Holloway (Nicky Guadagni), Rennes (Wayne Robson), and Leaven (Nicole de Boer). None of them know where they are, how they got there, or why they are there. Quentin, however, knows that there are traps, as he had looked into a room and nearly got his head cut off. The five decide to stay together and look for the way out. Rennes takes the lead. He exemplifies how to test for traps by tossing a boot into the rooms while holding onto the laces, to trigger potential traps, figuring that the trapped room contains motion detectors. Holloway speculates on several possible creators of the Cube, being aliens or the government his main ptions. Rennes remarks that staying still will not solve anything, and says that they should move in a straight line until they get to the end. The others agree, and they begin moving through the rooms.
While moving, they discover a series of different numbers on the hatchways between each of the rooms. At one point, Rennes throws the boot in and does not find anything, but detects that the room has dry air, and deduces that it most likely employs an electrochemical sensor, which detects hydrogen sulphide emitted from the skin. Quentin realizes that Rennes is an escape artist who has escaped more than seven major prisons. Soon after, Rennes jumps into a room tested with a boot, and is sprayed in the face with acid. The others pull him back, but he dies as the acid corrodes his face and the inside of his head. The group decides that the room must have contained an electrochemical sensor which Rennes missed, and realize that they must find a better way of testing the rooms.
Quentin asks everyone about their occupations. He says he is a police officer, Holloway says she is a doctor, and Worth says he works "in an office building, doing office building stuff." Leaven claims simply to "hang out" with her friends. Quentin believes that nothing is a coincidence, that each of them has a purpose in the cube. After Holloway talks about her rings and broaches, Quentin asks why Leaven has her glasses, while Holloway has had her jewellery taken away. Leaven reveals herself to excel at mathematics, and after looking at the numbers on a crawlspace, theorizes that when one of those numbers is prime, the room is booby-trapped.
Leaven's purpose becomes attempting to "crack the Cube's code", and they progress through the cubes. When they find themselves in a room with trapped rooms all around and below, Quentin checks the door in the ceiling, through which falls a seventh person: Kazan (Andrew Miller). He appears to be mentally handicapped. At least two of the others see him as a burden, but Holloway decides to bring him along.
The group starts speculating about their surroundings, which causes a conflict between Quentin and Holloway. Quentin dismisses Holloway's ideas as conspiracy theories, and Holloway thinks that Quentin is naive. Soon after this, Quentin enters a room without prime numbers and narrowly avoids death from a trap consisting of rotating razor wires. Leaven's theory that non-prime-numbered rooms are safe is shown to be incorrect. Quentin begins suspecting that Worth is a spy, and is increasingly irritated by Kazan's mental state. The group rests, while Leaven attempts to decipher the numbers.
After some time, Quentin tricks Worth into revealing that he is one of the architects who designed the enormous cube-shaped shell which contains the cube-shaped rooms. When asked about who contracted him to do the job, he states that he doesn't know. Although the others begin to distrust Worth (Quentin going as far as beating him), he is able to give them information about the dimensions of the outer cube: it is 434 feet (26 rooms) on each side, totaling 17,576 rooms. Leaven then intuits that the numbers between the rooms could be encoded cartesian coordinates representing the position of rooms within the Cube. The group begins moving towards the nearest edge. As for the traps, they begin to "boot" the rooms again.
The group is forced to pass through a room containing a sound-activated trap. Quentin argues to leave Kazan behind, but Holloway overrules him. Everyone makes it through, but when it is Quentin's turn, Kazan calls out, and nearly causes his death. Quentin, furious, nearly beats him, and when Holloway stops him, he turns on her and they argue heatedly, ending when Quentin slaps her. Despite the growing tensions, they continue.
The group finally reaches one of the side "edges" of the Cube, but discovers that there is a gap between the door and the outer shell. They fashion a rope from their clothes, and Holloway volunteers to swing out on the rope to investigate. As she is suspended outside the room, the Cube shakes and Holloway nearly falls. Quentin catches her, but then lets her fall to her death. He tells the others that she slipped, but they are dubious.
The group then decides to try to reach the "bottom" edge of the Cube, but agree that they need to rest before setting out for it. As they sleep, Quentin carries Leaven into another room. He tries to convince Leaven to abandon the others, and makes sexual advances at her and becomes abusive when it is obvious that she dislikes him. Worth and Kazan awaken and save Leaven. Quentin becomes paranoid, and says that he did not trust Holloway, to which the rest of the group guesses that he let her die. Enraged, Quentin beats and then throws Worth through a door in the floor. Worth laughs hysterically at what he sees in that room: Rennes's corpse. They think that they have been going in circles, but then Worth notices that the "acid room" which killed Rennes is no longer adjacent to that room. He and Leaven realize that the rooms must be moving. Leaven also realizes that rooms which have traps are marked with numbers which are not simply prime numbers, as she had previously thought, but the larger set of prime powers. The prisoners then face the task of performing prime calculations of three three-digit numbers for every room they enter. Fortunately, Kazan is at this point is revealed to be an autistic savant with the capacity to perform these calculations quickly and easily. He utters the number of distinct prime factors each number has, as the room numbers are read to him.
They make their way towards the exit safely with Kazan's help. Worth devises a plan to incapacitate Quentin, who has gone completely mad. Worth fights Quentin into a room below them and they leave him to die. They proceed and reach the bridge cube. When they open its door, bright light pours into the room. Worth announces that he will not go, as there is nothing for him in the world outside. As he and Leaven share a moment, Quentin appears having somehow managed to catch up with the trio, and kills Leaven by stabbing her with a door handle he somehow broke off a door. He stabs Worth as well, and grabs Kazan, who is climbing out. Worth grabs Quentin's leg with the last of his strength, and Quentin is crushed in the crawlspace between the cubes when the cubes realign. Having saved Kazan, Worth lies down next to Leaven and dies.
In the final shot, Kazan is seen walking slowly into a bright light.