As Lord Voldemort retrieves the Elder Wand from Albus Dumbledore‘s grave, Severus Snape has become Hogwarts headmaster. After burying Dobby, Harry Potter speaks with the goblin Griphookabout breaking into Bellatrix Lestrange‘s vault at Gringotts bank, suspecting that a Horcrux may be hidden there. Griphook agrees to take Harry, Ron, and Hermione to the vault in exchange for theSword of Gryffindor. Harry asks Ollivander, a wandmaker, to identify two wands they took from Malfoy Manor. Ollivander says they belonged to Bellatrix and Draco Malfoy, but Malfoy’s wand has changed its allegiance to Harry.
In Bellatrix’s vault, Harry discovers that the Horcrux is Helga Hufflepuff‘s Cup. He retrieves the Cup, but Griphook snatches the sword and abandons the trio, leaving them cornered by the alerted security. The three release the dragon guardian and flee on its back. Harry sees a vision of Voldemort killing goblins, including Griphook, and learns that the Dark Lord is aware of the theft. Harry also realises there is a Horcrux at Hogwarts, in some way connected to Rowena Ravenclaw. The trio apparate into Hogsmeade, and set off Caterwauling alarms. They are rescued by Aberforth Dumbledore, who instructs the portrait of his younger sister, Ariana, to fetch Neville Longbottom, who leads the trio through a secret passageway into Hogwarts.
Snape hears of Harry’s return and warns staff and students of the severe punishment for aiding Harry. Harry confronts Snape, who flees after Minerva McGonagall challenges him to a duel. McGonagall gathers the community of Hogwarts to prepare for battle. At Luna Lovegood‘s insistence, Harry speaks to Helena Ravenclaw‘s ghost. The ghost reveals that Voldemort performed “dark magic” on her mother’s diadem, which is in the Room of Requirement. Ron and Hermione go to the Chamber of Secrets, where Hermione destroys the Horcrux cup with a Basilisk fang. In the Room of Requirement, Draco Malfoy, Gregory Goyle and Blaise Zabini attack Harry, but Ron and Hermione intervene. Goyle casts a Fiendfyre curse and is burned to death, but Malfoy and Zabini are saved by the trio. Harry then stabs the diadem with the Basilisk fang and Ron kicks it into the Room of Requirement where it is destroyed. As the school is attacked by Voldemort’s forces, Harry, seeing into Voldemort’s mind, realizes that his snake, Nagini, is the final Horcrux. After entering the boathouse, the trio witness Voldemort telling Snape that the Elder Wand cannot serve him until Snape dies, and has Nagini kill Snape. Before dying, Snape tells Harry to take his memories to the Pensieve. Fred, Remus, and Tonks are killed in the battle.
Harry learns from Snape’s memories that Snape loved Harry’s mother, Lily, but despised his father James. Following her death, Snape worked secretly with Dumbledore to protect Harry from Voldemort because of his love for Lily. Harry also learns that Dumbledore’s death at Snape’s hands was planned between them. Harry discovers that he became a Horcrux when Voldemort originally failed to kill him and that Harry must die to destroy the piece of Voldemort’s soul within him. Harry goes to die at the hands of Voldemort in the Forbidden Forest. Voldemort casts the Killing Curse upon Harry, who then finds himself in a strange limbo where Dumbledore’s spirit meets him and explains that the part of Voldemort within Harry was killed by Voldemort’s own curse. Harry decides to return to his body to face Voldemort for the final time.
Voldemort announces Harry’s apparent death to everyone at Hogwarts, and that anyone who defies him will be killed. As Neville gives a defiant speech, Harry reveals that he is alive. Neville draws forth the Sword of Gryffindor from the Sorting Hat, and as Harry engages Voldemort in a duel throughout the castle, Neville decapitates Nagini, leaving Voldemort mortal. Molly Weasley kills Bellatrix in the Great Hall. Harry continues to battle Voldemort as Voldemort’s own curse rebounds and kills him. After the battle, Harry explains that the Elder Wand had recognized him as its master because he had disarmed Draco at Malfoy Manor, who in turn had disarmed its previous owner, Dumbledore. Harry snaps the Elder Wand, rejecting its power.
Nineteen years later, Harry and Ginny Potter, with Ron and Hermione Weasley, watch proudly as their children leave for Hogwarts from King’s Cross station.