Some two and a half centuries after its creation, the city of Ember is in a state of crisis. Chronic supply shortages and blackouts ravish the city, which is devoid of any natural light, while a deadly coughing disease plagues its populace. Ember’s surviving citizens, largely impoverished and often consumed by total darkness, live in fear and sense impending doom.

The story begins in the distant past, shortly after Ember’s “Builders” have completed construction of the city. Its chief builder, during a discussion with his assistant, reveals that its inhabitants must live there for at least 200 years and that the Builders will provide a list of critical instructions intended for Ember’s future citizens. The instructions will be sealed in a box with a timed lock programmed to open at the right date. Only the city’s mayors, in succession, are to know about the box, though none of them will know what is contained within. At this point, the Builders’ identity and their purpose for creating the city remain a mystery.

With Ember’s origin story, however vaguely, now established, the story fast-forwards to the present. It is year 241, though by now citizens have lost an accurate count of how many years have passed since the city’s inception. Twelve-year-old Lina Mayfleet, who has recently graduated from school and joined the adult workforce as a Messenger, finds the secret box in her apartment after her Granny dislodges it from the far depths of a closet. The box, now open, has remained there for generations after Lina’s great-great-grandfather and Ember’s seventh mayor, Podd Morethwart, absconded with the box and tried, unsuccessfully, to unlock it for his own benefit. Next to the box, Lina sees that her baby sister, Poppy, has torn and chewed its contents: a piece of paper, now in fragments strewn across the floor, lined with perfect printing that Lina believes must have come from the Builders.

Like all of Ember’s citizens, Lina has been taught that Ember stands alone, that it is a solitary city in an otherwise empty world engulfed in darkness beginning at the city’s edges and extending forever in the Unknown Regions. But she believes and has faith in a city of light, one she often dreams of and draws in pictures that decorate the walls of her apartment. She also believes that the piece of paper from the unlocked box contains a vital message that could save Ember from a tragic fate. 

Lina determines, then, to decode the paper’s message, filling in its broken and missing words. Lina enlists the help of Doon Harrow, a friend and former schoolmate who now works in the underground labyrinth of Ember’s Pipeworks and who shares her passion for saving the city. With assistance from Lina’s friend, Clary, who works in the city’s greenhouses, the two soon see that the message contains a seven-step list of instructions for exiting Ember. Its point of egress, they ultimately discover, is in the Pipeworks and its source, a raging underground river that powers the city’s failing generator. Their curiosity and determination also lead them to hidden rooms, hollowed out along the river’s edge and filled with matches, candles, and boats for all of Ember’s citizens to escape.

While Lina and Doon work to decode the message, they uncover unsettling truths about the city and some of its residents. Lina learns that her friend Lizzie Bisco has been stealing coveted storeroom goods with her boyfriend and fellow storeroom worker, Looper. While exploring an off-limits tunnel in the Pipeworks, Doon discovers a secret room where Mayor Cole hordes rare and precious supplies, including food and light bulbs. The two children take their findings to Assistant Guard Barton Snode at Ember’s Gathering Hall, but their attempts to reveal the mayor’s corruption backfire. City guards, conspiring with the mayor, set out to capture Lina and Doon and punish them for spreading what they say are vicious rumors. 

Lina and Doon had planned to reveal Ember’s exit instructions and the mayor’s lies at Singing, an annual event where citizens gather to sing the city’s three great songs. But as they hide from the guards in Ember School, they decide instead to exit the city that day after leaving a message with Clary so that their fellow citizens can do the same.

Lina and Doon escape with Poppy by boat and, after reaching the river’s end, see a sign from the Builders, welcoming refugees from Ember. They then ascend a steep passage that emerges into a vast wilderness lit with moonlight and other natural wonders they have never before seen. As Lina and Doon read a journal left near the river’s end by one of Ember’s first inhabitants, they can finally make full sense of Ember’s mystery: The Builders, a group of concerned scientists and engineers, created the city as an underground refuge for humans, believing the earth was in great peril at the time. Now, centuries later, Lina and Doon feel unsure if anyone is still alive on the surface. 

Having realized that Lina is still carrying the note for Clary, the children fear those remaining in Ember will not find the way out. As they search for a way back into Ember, they follow a steep climb leading to an indent in the earth and within a narrow tunnel that ends with an immense drop and a dramatic discovery: Visible by a cluster of electric lights, Ember exists at the bottom of the vast chasm, and the only way for Lina and Doon to make contact is with Clary’s note. Lina weighs the message down with a rock, wraps it in Doon’s shirt, and then hurls the bundle into the darkness below. Back in Ember, the message lands, directly in front of one of Lina’s neighbors.