Number the Stars is told from the point of view of ten-year-old Annemarie Johansen. The story is set in the city of Copenhagen, Denmark in September 1943, the third year of the Nazi occupation of Denmark. Annemarie and her best friend Ellen, who is Jewish, are stopped by soldiers on their way home from school. The two girls, who go to the same school and live in the same building, are unsettled by their first direct encounter with the Germans. Mrs. Johansen and Mrs. Rosen are concerned and ask the girls to take a new route to school. The encounter makes Annemarie reflect on what her father has taught her about Denmark and also about her older sister Lise's death a few years before the start of the novel. Later in the fall, Annemarie and her younger sister Kirsti discover that Mrs. Hirsch's neighborhood shop has been closed. This event further alarms Mrs. Johansen, though Annemarie does not understand why.

During a late night visit from Peter Neilsen, a member of the Resistance and the man Lise was to marry, Annemarie is told more about the war. Her parents and Peter explain that Jewish stores are being closed. The next day, the Rosens must flee. They leave Ellen with the Johansens. During the night, German soldiers come to the apartment demanding that Mr. Johansen disclose the location of his friends. He refuses and they search the apartment. Ellen pretends to be one of the Johansen's daughters, but her dark hair causes the solider to be suspicious. Luckily, Mr. Johansen is able to show them a baby picture of Lise with dark hair, which convinces the soldiers.

The next day, Mrs. Johansen takes the three girls to her brother Henrik's home in Gilleleje, Denmark, where Henrik is a fisherman. They spend a peaceful day in the house by the ocean before Henrik announces that their Great-aunt Birte has died. The service is to be held that evening. Annemarie knows that no such aunt exists, and demands the truth. Uncle Henrik explains the importance of not knowing too much when bravery is needed. That night the coffin arrives and they gather around it. Many more people arrive, but all are silent. Soon Peter appears with the Rosens, who are reunited with Ellen. Soldiers, drawn by the post-curfew lights, come to the house. They demand that the coffin be opened, a problem since the coffin is empty. Mrs. Johansen thinks quickly and says that her aunt died of highly contagious typhus. The soldiers leave.

Henrik takes the first group of people down to his boat. Mrs. Johansen follows with the Rosens. Annemarie, who now understands that the people are being taken to safety in Sweden, awaits her mother's safe return. When her mother does not appear, she discovers that Mrs. Johansen has broken her ankle. Because of this, Annemarie must take an important package to her uncle before they can leave. On the way to the boat, soldiers with dogs stop her. They search her basket and discover the package. But when they rip it open it contains only a handkerchief, and they let her go. Annemarie makes it to the boat in time, to Henrik's evident relief.

That evening, Henrik is safe at home having dinner with Annemarie, Kirsti, and Mrs. Johansen, whose ankle has been taken care of by the local doctor. After dinner, Uncle Henrik takes Annemarie to learn how to milk the cow. They talk about the events of the day. He explains that he hid his passengers in the bottom of the boat, and the handkerchief was essential because it kept the Germans' dogs from smelling the human cargo. Uncle Henrik praises Annemarie for her bravery and reassures her that Ellen is safe and they will meet again someday.

The war ends in May, and Annemarie and her family watch from their balcony as people parade in the streets with the Danish flag. Annemarie thinks of the Rosens and realizes that they, along with all the others who were forced to flee, will soon be returning home. Peter Nielsen has died. He was shot in a public square for his involvement in the Resistance. Annemarie's parents tell her that Lise was a member of the Resistance, too, and that she did not die in an accident, but was killed by the Germans. Thinking of Lise and of Ellen, Annemarie goes to the trunk of Lise's things in her room and takes out the Star of David pendant that she has been keeping for Ellen. She says she will wear the necklace herself until Ellen returns.