At the beginning of the story, a coalition of architects, scientists, and doctors known as "The Builders" have assembled 'Ember': a subterranean city with supplies for its inhabitants to survive at least 200 years, to elude an impending disaster; they give the first mayor of the city a locked box, holding instructions for the city's inhabitants, to be passed down from one mayor to the next. This passage continues until the seventh mayor who, in search of a cure for the deadly cough infecting himself and his citizens, tries and fails to break it open, and dies unable to return the box to its rightful place, or inform anyone else of its importance. 241 years after Ember is established, the city's supplies are in danger of exhaustion, and the hydroelectric generator is in decay. At a graduation ceremony where young people are assigned their jobs, protagonist Lina Mayfleet is assigned the job of “Pipeworks Laborer" and her classmate Doon Harrow that of “Messenger”. However, both are displeased with their given jobs; they mutually exchange assignments in secret. At home, Lina's grandmother tries to find something. Lina's sister, Poppy, exposes the instructions left by the Builders; but in teething, leaves them almost illegible. Later, Lina asks Doon to help her reconstruct the paper. After much trial and error, she and Doon decipher the instructions from the Builders, which inform them of how to exit the city of Ember. One morning, Lina's grandmother dies, and Lina and Poppy move in with a neighbor, Mrs. Murdo. At work, Doon discovers that the mayor of Ember and a storeroom worker named Looper have been stealing supplies, and he and Lina report the crime. Upon following the instructions given in the note, they discover boats and candles meant for use in the exodus. On their return to Ember, they learn that the mayor has declared them fugitives from the law. Lina is arrested and taken to the mayor, who threatens to jail her. Suddenly, a blackout allows her escape; whereupon Lina, Doon, and Poppy escape in a boat through the river that supplies Ember's electricity. When the boat stops, they learn the origin of Ember from a diary left by one of its original colonists. Thereafter they are faced with a very steep climb and emerge onto the surface, where they see their city from above and realize, for the first time, that Ember is underground. They throw a rock with instructions tied to it down to the city in hope that the people of Ember will escape. The novel ends with Mrs. Murdo finding their note. therefore continuing in the city of sparks.