Prior to the events of the film, a Scientist is ordered by his dictator to create a robot in the apparent name of progress. The Scientist uses his own intellect to create the B.R.A.I.N., a robot with a soulless ability. However, the dictator quickly seizes it and integrates it into the Fabrication Machine, an armature that can construct an army of war machines to destroy the dictator’s enemies. Lacking a soul, the Fabrication Machine becomes corrupted, sadistic, and bloodthirsty that it had the idea to exterminate all of earth’s population. The Fabrication Machine reprograms the other war machines to attack humanity, wiping out all plant, animal and microbial life with toxic gas and chemical weapons. On the verge of destruction, the Scientist who created B.R.A.I.N. uses alchemy to create nine homunculus-like rag dolls known as “Stitchpunks”, giving them portions of his own soul via a talisman he created, & dies as soon as the final one is ready.
Sometime later, that final doll, 9, all of a sudden awakens in the Scientist’s workshop. Taking the talisman with him, 9 ventures into the devastated city and meets 2, a frail inventor who gives him a voice box and is surprised when 9 reveals the talisman. The last active machine, the Cat-Beast, attacks the pair and takes 2 and the talisman. 9 collapses, but awakens in Sanctuary, an empty cathedral that is home to other Stitchpunks, including the dogmatic leader 1, his large bodyguard 8, the cycloptic engineer 5, and the mentally unstable oracle 6. 1 immediately declares 2 as dead, but 9, having seen the condemned factory where the Cat-Beast has taken 2, decides to rescue him. 9 and 5 venture to the factory where they find 2. Meanwhile, 7, the only female of the Stitchpunks, arrives and slays the Cat-Beast. 9, drawn by curiosity, connects the talisman to the previously derelict Fabrication Machine, causing it to absorb 2’s soul, reviving the machine and killing 2 in the process whilst 9, 5, and 7 manage to escape the factory.
7 takes 9 and 5 to an abandoned local library, where the silent scholar twins, 3 and 4, show 9 the Fabrication Machine’s origins. 5 realizes the talisman’s symbols match the clairvoyant drawings of 6. 9 and 5 return to Sanctuary to investigate, but 1 decides to intervene by confronting and reprimanding them. The Fabrication Machine starts constructing new machines; one of them, the bird-like Winged Beast, attacks Sanctuary, leading to a battle between the Stitchpunks and the Winged Beast. 7 joins the fight, but is injured. 5, 6, and 8 soon murder the Winged Beast.
As the group retreat to the library, 6, 3, and 4 cryptically explain the talisman’s origins, but 1 reprimands the group again before revealing that he sent 2 out of Sanctuary on a scouting trip to die. So, 7 gets shocked, & loses her temper by lashing out at 1 before running off when 9 prevents her from attempting to murder 1. Meanwhile, the Fabrication Machine retrieves 2’s corpse and uses it as a hypnotic lure for another machine, which is the Seamstress (another one of its hitmen). So the Seamstress then attacks the library and captures 7 and 8, but 2’s body is recovered and given a funeral by the others. The others then run to the factory to destroy the machines. 9 goes inside alone, kills the Seamstress, and rescues 7, but not before witnessing 8’s soul being absorbed by the Fabrication Machine. 9 and 7 escape while the others destroy the factory.
The Stitchpunks celebrate the destruction of the factory, but the Fabrication Machine, which survived, suddenly emerges from the ruins of the factory and absorbs 5’s soul after surprising the other Stitchpunks. The Fabrication Machine soon attacks the group and eventually captures 6, who is absorbed but not before telling 9 to go to the Scientist’s workshop to find answers. 9 follows 6’s instructions, finding a holographic recorded message from their scientist creator, who explains that the Stitchpunks are all a part of himself, making them the only hope for humanity. After that 9 realizes how the talisman can be used against the Fabrication Machine to free the captured Stitchpunks’ souls.
9 reunites with the other Stitchpunks and devises a plan to sacrifice himself to allow the others to retrieve the talisman from the Fabrication Machine. 1, having had a change of heart, redeems himself after saving 9 by pushing him out of the way, allowing himself to be absorbed and giving 9 the opportunity to remove the talisman. The Fabrication Machine desperately tries to grab it in as its temper is running out, but 9 activates it and uses it to reabsorb the souls taken by the Fabrication Machine, resulting in its demise by exploding into pieces of spare parts. And shortly after that 9, 7, 3, and 4 free the souls of 5, 1, 6, 2, and 8 from the talisman and they fly up into the sky, causing it to rain. The final image shows that the raindrops contain small flecks of glowing bacteria, bringing people back to the abandoned, earth.