Following Dumbledore's death, Voldemort continues to gain support and increase his power. When Harry turns seventeen, the protection he has at his aunt and uncle's house will be broken. Before that can happen, at Mad Eye Moody's suggestion, Harry flees to the Burrow with his friends, many of whom use Polyjuice Potion to impersonate him so as to confuse any Death Eaters that may attack. They are indeed attacked shortly after leaving Privet Drive; Mad Eye is killed, and George Weasley wounded, but the rest arrive safely at the Burrow. Harry, Ron, and Hermione know they cannot return to Hogwarts School for their seventh year. Instead, they decide to finish the quest Dumbledore started: to hunt and destroy Voldemort's remaining Horcruxes, objects in which he has hidden parts of his soul for the purpose of being immortal. They isolate themselves to ensure their friends and families' safety. They have little knowledge about the remaining horcruxes except the possibility that two are objects once belonging to Hogwarts founders Rowena Ravenclaw, Helga Hufflepuff and a third may be Nagini, Voldemort's snake familiar. The whereabouts of the two founders' objects is unknown, and Nagini is presumed to be with Voldemort. As they search for the Horcruxes, the trio learn more about Dumbledore's past. Bill Weasley and Fleur Delacour are married, but the wedding is disrupted by the news that Voldemort has taken over the Ministry of Magic.Harry, Ron, and Hermione flee into London and to 12 Grimmauld Place, where they learn from Kreacher the whereabouts of Salazar Slytherin's locket. They successfully recover this Horcrux by infiltrating the Ministry of Magic and stealing it from Dolores Umbridge. Under the object's evil influence and the stress of being on the run, Ron leaves the others. Harry and Hermione travel to Godric's Hollow, Harry's birthplace and the place where his parents died. They meet the eldery magical historian Bathilda Bagshot, who turns out to be Nagini in disguise and attacks them. They escape into the Forest of Dean, where a mysterious silver doe leads Harry to the Sword of Godric Gryffindor, one of the few objects able to destroy horcruxes, lying at the bottom of an icy lake. When Harry attempts to recover the sword from the pool, the horcrux attempts to kill him. Ron reappears, saving Harry and using the sword to destroy the locket. Resuming their search, the trio repeatedly encounter a strange symbol that an eccentric wizard named Xenophilius Lovegood tells them represents the mythical Deathly Hallows. The Hallows are three sacred objects: the Elder Wand, an unbeatable wand; the Resurrection Stone, with the power to summon the dead to the living world; and an infallible Invisibility Cloak. Harry learns that Voldemort is seeking the Elder Wand, but is unaware of the other Hallows and their significance.
The trio are captured and taken to Malfoy Manor, where Bellatrix Lestrange tortures Hermione. Harry and Ron are thrown in the cellar, where they find Luna Lovegood, Ollivander, Dean Thomas, and Griphook. They escape to Shell Cottage (Bill and Fleur's house) with Dobby's help, but at the cost of the house-elf's life. Harry knows that Voldemort robbed Dumbledore's tomb and procured the Elder Wand, but he decides to focus on the Horcruxes instead of the Hallows. With Griphook's help, they break into Bellatrix's vault at the Wizarding Bank Gringotts. They retrieve Helga Hufflepuff's cup - a Horcrux - and escape on a dragon. Harry learns that another Horcrux is hidden in Hogwarts, which is under the control of Severus Snape. Harry, Ron, and Hermione enter the school through Hogsmeade (being saved by Aberforth Dumbledore, who explains more about Albus's backstory) and - with the help of the teachers - Snape is ousted from the school. Ron and Hermione go to the Chamber of Secrets and destroy the cup. The trio find Rowena Ravenclaw's diadem (another Horcrux) in the Room of Requirement. Vincent Crabbe casts a Fiendfyre curse in an attempt to kill Harry, Ron, and Hermione, but he instead destroys the diadem, the Room of Requirement, and himself.
The Death Eaters and Voldemort besiege Hogwarts, while Harry, Ron, Hermione, their allies, and various magical creatures defend the school. Several major characters are killed in the first wave of the battle, including Remus Lupin, Nymphadora Tonks, and Fred Weasley. Voldemort kills Severus Snape because he believes doing so will make him the Elder Wand's true master. Harry discovers while viewing Snape's memories that Voldemort inadvertently made Harry a horcrux when he attacked him as a baby and that Harry must die to destroy Voldemort. These memories also confirm Snape's unwavering loyalty to Dumbledore and that his role as a double-agent against Voldemort never wavered after Voldemort killed Lily Evans, Harry's mother and Snape's one true love. It is revealed that Dumbledore had less than a year to live when he died, and that his death by Snape's hand had been per Dumbledore's request, to protect Draco Malfoy's soul. After using the Resurrection Stone to bring back his deceased loved ones for a short while, Harry surrenders himself to death at Voldemort's hand. Voldemort casts the Killing Curse at him, sending Harry to a limbo-like state between life and death. There, Dumbledore explains that when Voldemort used Harry's blood to regain his full strength, it protected Harry from Voldemort harming him; the Horcrux inside Harry has been destroyed, and Harry can return to his body despite being hit by the Killing Curse. Dumbledore also explains that Harry became the true master of the Deathly Hallows by facing Death, not by seeking to avoid or conquer it. Harry returns to his body, feigning death, and Voldemort marches victoriously into the castle with his body. However, he shows that he is still alive while Neville Longbottom kills Nagini, the last horcrux, with the Sword of Gryffindor. The battle resumes, and Bellatrix Lestrange is killed by Molly Weasley.
Harry and Voldemort engage in a final climactic duel. Harry reveals that because he willingly sacrificed himself to death by Voldemort's hand, his act of love would protect the Wizarding community from Voldemort in the same way the sacrifice Harry's mother made protected Harry. Harry also reveals that Snape was never loyal to Voldemort and did not murder Dumbledore (Snape killed Dumbledore at Dumbledore's request). Voldemort, who murdered Snape, was never the master of the Elder Wand. Draco was the master of the Elder Wand after disarming Dumbledore, but Harry disarmed Draco at Malfoy Manor, making Harry the true master of the Elder Wand. The wand refused to kill the one to whom it had allegiance, further protecting Harry. During the duel, Harry refuses to use the killing curse and even encourages Voldemort to feel remorse, one known way to restore Voldemort's shattered soul. Voldemort dies when his own killing curse backfires; he and his Death Eaters are finally defeated. The wizarding world is able to live in peace once more.