Following Dumbledore's death, Voldemort consolidates his support and power, including covert control of the Ministry of Magic, while Harry is about to turn seventeen, losing the protection of his home. The Order of the Phoenix move Harry to a new location before his birthday, but are attacked upon departure. In the ensuing battle, Mad-Eye is killed and George Weasley wounded; Voldemort himself arrives to kill Harry, but Harry's wand fends him off of its own accord.
At the Burrow, Harry, Ron and Hermione make preparations to abandon Hogwarts and hunt down Voldemort's four remaining Horcruxes, but have few clues to work with on their identities and locations. One is a locket once owned by Hogwarts' co-founder Salazar Slytherin which was stolen by the mysterious "R.A.B.", one is possibly a cup originally belonging to co-founder Helga Hufflepuff, a third might be connected to co-founder Rowena Ravenclaw, and the fourth might be Nagini, Voldemort's snake familiar. They also receive apparently meaningless bequests from among Dumbledore's possessions—a Golden Snitch for Harry, a Deluminator for Ron, and a book of fairy tales for Hermione.
Before leaving, they attend Ron's brother Bill's wedding, but during the reception the Ministry of Magic finally falls to Voldemort and the wedding is attacked. They flee to 12 Grimmauld Place in London, the family home of Sirius Black that Harry had inherited a year before. They identify R.A.B. as Sirius' brother Regulus Black, and learn from the house-elf Kreacher that Slytherin's locket was stolen from the house and then seized by Dolores Umbridge of the Ministry of Magic. They infiltrate the Ministry of Magic using Polyjuice Potion and take back the locket, but have no way to destroy it. With the Ministry now after them, the trio goes on the run across the countryside. Under the object's evil influence and the strain of constant vigilance, they argue and Ron leaves.

Hermione identifies in Dumbledore's book a strange symbol also worn at the wedding by Xenophilius Lovegood. They visit him and are told the symbol represents the mythical Deathly Hallows, three objects from an old fairy tale titled The Tale of the Three Brothers: the Elder Wand, an unbeatable wand; the Resurrection Stone, able to summon the dead; and an infallible Invisibility Cloak. Harry realises that Voldemort is seeking (and later successfully obtains) the Elder Wand, won by Dumbledore after Grindelwald's defeat, believing it will allow him to overpower the connection between his own wand and Harry's. Harry also recognises the Resurrection Stone as that found by Dumbledore which later become the second Horcrux, and believes it to be hidden inside the Snitch Dumbledore left for him, but can't open it. The description of the third Hallow also matches that of his own inherited Invisibility Cloak.
The trio are captured by Snatchers and taken to Malfoy Manor, where Bellatrix Lestrange tortures Hermione to learn how the three acquired the sword, which she had believed was in her vault at Gringotts. With the help of Dobby the house-elf they escape along with fellow prisoners Luna Lovegood, Ollivander, Dean Thomas, and the goblin Griphook. During the escape Harry steals Draco Malfoy's wand and Dobby dies. Bellatrix' terror in interrogating Hermione suggests to Harry that some exceptional object is in her vault, and when questioned, Griphook confirms that a gold cup is indeed in her vault. With Griphook's help, they break into the vault at Gringotts, retrieve the cup, and escape on a dragon, but in the chaos they lose the Sword of Gryffindor. Harry has a vision of Voldemort and sees that he now understands their plan, and intends to make his remaining horcruxes even safer. The vision also confirms that the unidentified horcrux is at Hogwarts.

In his encampment, Voldemort feels that the Elder Wand is not performing as he expected. According to legend, its allegiance must be won by killing the previous owner, and Voldemort concludes—incorrectly—that as Snape killed Dumbledore, he will not be able to fully wield the wand's power until he kills Snape, which he does. Harry arrives as Snape is dying, and Snape passes him memories to view in a pensieve. They reveal that Snape had a lifelong love for Harry's mother and felt haunted by causing her death, and despite hating Harry's father he agreed at Dumbledore's request to watch over Harry and act as a double agent against Voldemort. The doe Patronus that led Harry to the Sword was summoned by Snape, who was watching over them the whole time. It is revealed that Dumbledore's death was planned in advance to prove Snape's allegiance to Voldemort. The memories also explain that Harry must die at Voldemort's hand if Voldemort is to be killed. Harry accepts his death and goes to the Forbidden Forest to allow Voldemort to kill him. On the way he mentions to Neville Longbottom that Voldemort's snake Nagini must be killed to make Voldemort vulnerable. He finally manages to open the Snitch and uses the Resurrection Stone within to seek comfort and courage from his dead loved ones—his parents, Sirius and Lupin—dropping the Stone in the forest before reaching Voldemort's camp. Voldemort uses the Killing Curse and Harry does not defend himself.
Harry awakens in a dreamlike location resembling Kings Cross Station and is greeted by Dumbledore, who explains that Voldemort's original Killing Curse left a fragment of Voldemort's soul in Harry which caused the connection they had felt, making Harry an unintended Horcrux; this fragment has just been destroyed by Voldemort himself. When Voldemort used Harry's blood to regain his full strength, this further protected Harry from Voldemort, allowing Harry to return to life if he chooses, or to "go on." Harry chooses to return and feigns death. Voldemort displays Harry's body and offers a truce if the defenders surrender, but Neville kills Nagini with the Sword of Gryffindor, leaving Voldemort unprotected, and Harry escapes under his cloak as the battle resumes.
In a final onslaught, Bellatrix is killed and Harry reveals to Voldemort that he is alive. He explains to Voldemort that the Elder Wand's loyalty transfers upon the defeat, not necessarily the killing, of its previous master. Although Voldemort believes he has won the wand's allegiance by killing Snape, who killed Dumbledore, in fact Draco Malfoy had earned the Wand's loyalty by disarming Dumbledore just before his death. Therefore, the outcome of their duel will depend upon whether the Elder Wand knows that Harry had disarmed Malfoy weeks prior, leaving Harry as its true master, even though neither Draco nor Harry ever physically held it. Voldemort attempts one final Killing Curse on Harry, but the Elder Wand refuses to act against Harry and the spell rebounds, killing Voldemort at last.
After Voldemort's death, Harry uses the Elder Wand to repair his original broken wand, saying that he will return it to Dumbledore's tomb, where its power may vanish if Harry dies undefeated and where it may drop out of history. The wizarding world returns to peace once more.