Nora Seed, a 36-year-old music store clerk, is struggling to cope with overwhelming regret about the state of her life. In a period of just over a day, Nora’s cat dies, she loses her job at the music store, she has a confrontational run-in with her former bandmate, and she loses her lone piano student. Her brother Joe is avoiding her, her best friend Izzy isn’t responding to her text messages, and even her next-door neighbor, old Mr. Banerjee, says he doesn’t need Nora to help him with his medications anymore. Her parents have passed away, her father when she was a teenager, and her mother just a few years ago. After her mother’s death, Nora left her ex-fiancé, Dan, just two days before they were supposed to be married. Nora surveys her life and sees only pain, grief, and regret. She decides that she has nothing left to live for. She leaves a note, makes a final post on social media, and attempts to kill herself.

When Nora awakes from her attempt, she finds herself in front of a strange building. When she enters, all she can see in every direction is books. She encounters Mrs. Elm, her beloved high-school librarian who comforted her when Nora’s father passed away. Mrs. Elm explains that Nora is in a place in between life and death called the Midnight Library. She tells Nora that time doesn’t move here, and when Nora examines her watch, she sees that it is frozen at midnight. Mrs. Elm introduces Nora to The Book of Regrets, which articulates everything Nora has regretted in her life. The other books contain infinite variations of Nora’s life. Any book she chooses will allow her to see how her life would have turned out if she had made different choices. As soon as Nora feels disappointed in a life she visits, she will return to the Midnight Library. Nora still wants to die and is uninterested in the library, but Mrs. Elm encourages her to pick a book anyway. The first life Nora visits is the one in which she married Dan, and they own a pub together in the English countryside.

In her life with Dan, Nora is impressed to see that they have accomplished Dan’s dream of owning a pub in the English countryside. She quickly learns, however, that Dan cheated on her, and in the course of their interactions, Nora remembers how difficult her relationship with Dan often was. She wonders if they’ve outgrown each other, and she returns to the Midnight Library, where she is still filled with despair. Mrs. Elm coaches her to think of another life she might want to visit, and Nora chooses one in which she has kept her cat Volts inside, hoping he would live longer. In that life, she immediately finds that Volts is dead beneath her bed. She returns to the Midnight Library angry with Mrs. Elm. Mrs. Elm explains that Volts would have died in any life because he had a heart condition. Nora learns that she was a good cat owner to Volts, and her regret about not taking good enough care of him disappears from The Book of Regrets.

Nora continues to visit many iterations of her life. She sees that if she had gone to Australia with her best friend then Izzy would have died in a car wreck on the way to Nora’s birthday party. If she became an Olympic swimmer as her father had wanted, her father would have lived much longer, but her mother would have died much sooner. In that life, Nora has all the trappings of power and is poised to give a talk about success to a room full of thousands of people. But she recognizes that this successful life is lonely, and in many ways, she’s still suffering there. 

Next, Nora sees the life she would have had if she had become a glaciologist, a dream she had when she was very young. There, she has a near-death encounter with a polar bear, and facing death makes her realize that she truly wants to live. She also encounters another person who is sliding between lives, Hugo, who shares his observations about the nature of reality. She leaves that life to experience what it would be like if her band with her brother, The Labyrinths, had made it big. She’s a wildly successful rock star with millions of Instagram followers. She briefly enjoys the trappings of fame before learning that she’s embroiled in a complicated series of scandals and tragedies. When she learns that Joe died of a drug overdose two years prior, she is transported back to the Midnight Library.

Nora slides into alternate lives many times, and she begins to enjoy the process of learning more and more about herself and the world. However, after a while, she begins to lose herself and feels as though she wants to find a life that she can settle into. She slides into a beautiful life, with her loving husband Ash and daughter Molly, work she enjoys, and a nice home. It’s a life filled with love and ease, and she reminds herself again and again that it is a good life. As she visits the neighborhood from her root life, Nora sees the positive impacts her small actions have had on others. Nora realizes that no matter how good her life with Ash and Molly is, she didn’t earn it. Though she badly wants to stay and feels deep love for her family, Nora can’t stop herself from sliding back to the library.

Distraught, Nora begs Mrs. Elm to return her to the good life, but the Midnight Library is falling apart. The books are all catching on fire. Nora’s watch starts keeping time again, and Mrs. Elm says it’s possible that Nora is dying in her root life. But Nora deeply wants to live. She races to the book of her root life and writes “I AM ALIVE” on one of its blank pages. With that, the Midnight Library disappears, and Nora finds herself on the brink of death in her root life. She seeks out help from her neighbor and ends up in the hospital. Nora reconciles with her brother, who begs her not to leave him again, and with Izzy, who wants to catch up. Nora is filled with gratitude. She visits Mrs. Elm, and they play a game of chess, reflecting that one never knows how the game, or life, will end.