Set in 1982, Molly, Sophie Nélisse, is a teenage girl living in Baltimore with her widowed mother Jean, Maria Bello, and younger brother Michael, Liam Dickinson. When Jean marries Dave, Callum Keith Rennie, a writer and widower, the newly formed family moves to an isolated rural church converted into a house on the edge of Holwell. On the way, they stop at a psychiatric hospital to collect Dave’s preadolescent daughter Heather, Isabelle Nélisse, who has spent the previous three years there, haunted by the trauma of seeing her mother die in a house fire.
Heather is pulled toward a blue butterfly and follows it deeper into the surrounding woods. Their exploration brings them to the churchyard, cared for by the kindly old Mr. Simmonds, Frank Adamson. There, Molly and Heather discover a memorial plaque—not a grave—for Helen Harper, a six-year-old girl whose initials are H.E.H., the same as Heather’s. Curious, they turn to Mrs. Williams, the local librarian, Mary Downing Hahn, who unearths records and photographs that reveal Helen Harper died with her parents in a fire in 1886, a tragedy in which no remains were ever found.
As Heather befriends Helen’s ghost, a bond forms. Helen leads her to the ruins of her former house beside a river, and the two girls spend time there, playing as if the past and present have grown tangled. Besides Heather, Molly is the only living person who can see Helen—a gift that Molly shares with her late father, who was known for his visions. When Molly tries to tell the rest of the family about Helen, they dismiss her as crazy. Only Mr. Simmonds believes her, remembering how his departed wife Rose shared the same gift when she was alive. He also warns Molly to be careful, noting that several young girls have vanished over the years after befriending Helen’s ghost (a girl is seen walking into the river during the opening credits).
Determined to protect Heather, Molly keeps a watchful eye on her as she forms a fragile friendship with Helen. Heather runs away to Helen’s house, and Molly’s father appears to her in a dream, warning her of danger. Molly wakes and races after Heather, arriving to witness a vision of how Helen accidentally closed a trap door—an event Helen could never unlock when she and her parents were alive in the basement. The moment grows tense as a candle is knocked over, and the ensuing fire claims the lives of Helen’s parents while Helen herself escapes to the river, where she drowns.
Heather then tries to join Helen in the river and begins to slip beneath the surface. Molly acts quickly, pulling the unconscious Heather from the water and reviving her on the shore. Heather reveals that she accidentally killed her mother while trying to cook for her, beginning a devastating house fire, and she confesses that she and Helen truly understand each other.
Molly discovers the trap door to the basement in the ruins and, with Helen’s spectral help, finally opens it. Inside lie the bodies of Helen’s parents, their spirits trapped for years. The blue butterfly, a nickname the Harper family used for Helen, lands on the corpses as a quiet sign of release. Michael arrives to join Molly and Heather, and together they witness the spirits of Helen’s parents ascend to the heavens, freed at last, with Helen accompanying them in the moment of release.