The movie opens with Voldemort stealing the Elder Wand, which occurs in the book right after Harry's talk with Ollivander. Once Harry determines that there is probably a Horcux in Bellatrix Lestrange's vault, the film immediately cuts to them executing their raid. In the book they spend about a month planning out every detail. Bill Weasley also warns them not to trust Griphook, as Goblins still consider themselves master of the Griffindor sword, even though they had sold it to the wizards. In the book, both Luna Lovegood and Dean Thomas were rescued from Malfoy Manor, and are apparated to safety along with Ollivander before the trio sets out. Also during this time, Remus Lupin (with whom Harry had had a major rift earlier in the book) arrives and announces the birth of his son Teddy (to whom he refers later in the book and film). He asks Harry to be Teddy's godfather, which Harry accepts.
The raid on Gringotts happens largely as it does in the book, although with less danger or threat than the book gives this sequence (e.g. the duplicating artifacts in the Vault are also extremely hot). This film, like the others (except Goblet of Fire) differs in its portrayal of Polyjuice Potion, in that the user's voice (Hermione in this case) remains unchanged.
Instead of also relying on the memories Dumbledore had shown him to identify Horcruxes (in the book), Harry fully discovers through his connection with Voldemort's mind what they are and where they are hidden in the movie. In the book, Harry witnesses how Voldemort is checking up on all his previous Horcruxes, since he cannot sense their destruction, and finds most of them missing (in the movie, Voldemort instantly feels it when his soul fragments are destroyed, and it temporarily weakens him).
When they meet Aberforth in the book, he confronts the Death Eaters pursuing them and tricks them into thinking they were pursuing a false alarm. The mirror fragment that Harry carries around is from one mirror that he received from Sirius in Order of the Phoenix; its twin mirror is found in Aberforth's hide-out. In the movie, there is only one mirror. Aberforth goes into depth about his troublesome past with Albus: their sister Ariana was once assaulted by three Muggle boys, and from the trauma, she became unable to control her magic. Their father killed the Muggles in revenge and spent the rest of his life in Azkaban. Then their mother was accidentally killed during one of Ariana's fits of rage, forcing Albus to abandon his career and care for his sister as Aberforth attended Hogwarts. During one summer, Albus formed a friendship with Grindelwald, and together they dreamt of a world where wizards dominated over Muggles for the greater good, and they obsessed over the Deadly Hallows. One night, this led to a heated argument with Aberforth, culminating in a duel where a stray Killing Curse killed Ariana.
While searching for the Ravenclaw diadem, Harry is discovered by Alecto Carrow, who, before getting stunned, immediately warns Voldemort through her Dark Mark. In the ensueing chaos, Amycus is incapacitated as well. While Harry follows Professor McGonagall under his Invisibility Cloak, she is confronted by Snape in a hallway, leading to a fierce duel, with Snape jumping out of a window, clinging to a bat-like creature (in the movie, Snape summons all students to the Great Hall, trying to coerce the students into betraying Harry. Harry himself confronts Snape, but McGonagall fights him off, after which Snape Disapparates). Harry first asks professor Flitwick about the diadem, who has no clue, then Nearly Headless Nick (who hasn't appeared in the films since the second), who sends him to Helena Ravenclaw. Helena admits to be the daughter of Rowena Ravenclaw (one of Hogwart's founders). She had once stolen her mother's diadem and hid it; the Bloody Baron (Slytherin's house ghost) was send to retrieve both Helena and the diadem, but when she refused, the Baron killed her and himself in remorse, becoming ghosts.
Ron and Hermione destroying the Hufflepuff Cup is shown in the movie but only recounted in the book; Hermione kisses Ron afterwards, after Ron suggests that he should help the House Elves. Malfoy enters the Room of Requirement with Crabbe and Goyle, and it is Crabbe who dies. The Fiendfire in the Room is enough to destroy the Horcrux (in the movie it requires another stab with the Basilisk fang).
Professor McGonnagall's giggle about always having wanted to use "Piertotum Locomotor" (awakening the statues, suits of armor, etc., to defend the school) is a movie invention not in the book.
Snape is killed in the Shrieking Shack—in which he has some significant personal history—rather than the boathouse, which was an environment that appears exclusively in the film.
Snape's memories are far more expansive in the book, and include excerpts from Snape's life at Hogwarts and friendship with Lily; however, the friendship ends abruptly, due to Snape's grudge against James Potter and his own affiliation with the Death Eaters. There are several memories proving Snape's allegiance to Dumbledore: spying on Professor Quirrel and Durmstrang Headmaster Karkaroff, plotting with Dumbledore's portrait in the Headmaster's office, secretly helping Harry obtaining the Griffindor sword, and his reluctance to promise to kill Dumbledore (which Harry semi-witnessed in the film and Hagrid in the book of Half-Blood Prince). It also shows how Snape tried to prevent harm to George Weasley on the night that the Order of the Phoenix escorted Harry back to the Burrow, but inadvertantly cursed his ear off. However, the scene where a heart-broken Snape finds Lily and James killed by Voldemort was conceived especially for the film and is not in the book.
The scope of the Battle of Hogwarts has been expanded in the movie to include viewpoints besides Harry's. Fred Weasley's death is actually shown in the book, though that of Lupin and Tonks is not. In the book, the Death Eaters are joined by many other creatures, such as spiders and Giants.
Harry's conversation with Dumbledore clears up some mysteries: Harry can come back from limbo due to the protection provided by his mother's blood: when Voldemort was resurrected with Harry's blood, that protection fortunately went over to Voldemort's blood as well; as long as Voldemort is alive and nearby, Harry is protected. Also, the reason that Harry's wand was able to fight off Voldemort on its own in the previous movie, is because Harry shares blood and a piece of soul with Voldemort; when their wands connected in Goblet of Fire, Harry's wand learned to sense Voldemort's actions, and could act on its own.
Dumbledore goes into detail about his friendship with Grindelwald and their youthful quest for power. Both wanted the Elder Wand to rule over the Wizarding World; he himself wanted the Resurrection Stone to reunite his dead family, whereas Grindelwald only wanted it to raise an army of Inferi. However, Dumbledore clashed with Grindelwald over the issue of Muggles (whom Grindelwald wanted to enslave), and with Aberforth over his intention to find the Invisibility Cloak to hide their sister Ariana, whom he saw as a burden. This caused a heated argument that led to a fierce three-way duel, in which Ariana was hit by a stray Killing Curse. Unsure who fired the fatal curse, a remorseful Dumbledore did not dare to confront Grindelwald for years, out of fear that he might learn that he accidentally killed his own sister. Dumbledore also explains that upon finding out that the black Marvolo ring contained the Resurrection Stone, he immediately put it on, just to see his dead sister once more and ask for her forgiveness; however, he temporarily forgot that it was a Horcrux and carried a lethal curse.
Upon returning from death, Voldemort uses the Cruciatus curse on Harry's body to reassure himself that Harry is dead; the curse has no effect on him (not because Harry is dead, but because the Elder Wand will not harm its master). While carrying Harry to Hogwarts, Hagrid scolds the onlooking Centaurs for not interfering.
The final confrontation is also different. In the book, upon arriving at Hogwarts, Voldemort punishes Neville for his refusal to join him by cursing him with a Full Body Bind, and putting the burning Sorting Hat on his head. At that point, hordes of wizard families climb over the walls, together with Centaurs, Thestrals, Buckbeak and Grawp, which starts another battle that moves into the castle. In the confusion, Harry escapes and hides under the Invisibility Cloak, while Neville is freed from the curse, takes the Griffindor Sword from the Sorting Hat and immediately decapitates Nagini with it (in the movie, Ron, Hermione and Neville have to chase the snake all the way through the castle during the duel).
The book version of the duel does not involve Harry and Voldemort separating from the others and Apparating around the castle, with Harry revealing who the master of the Elder Wand is. Instead, Harry searches for Voldemort under his Cloak, finding that the Death Eaters' curses have little effect on his friends (later explained as a result of his sacrifice; like his mother, Harry gave his life for his friends, and his blood now protects them from harm). He finds Voldemort fighting off many other wizards, and becoming enraged when Bellatrix is killed by Mrs. Weasley. But before he can harm her, Harry reveals himself. He gets to deliver a lengthy speech, in which he both taunts and offers an olive branch to Voldemort: a chance to repent for all his actions, and a warning that the Elder Wand is now under his control (because Draco became its master when he disarmed Dumbledore, and Harry in return became master when he took Draco's wand in Malfoy Manor). More importantly, he reveals that Snape had never been Voldemort's man from the moment he targetted Lily Potter, revealing to all Snape's duplicitous heroic role. Voldemort nevertheless fires the Killing Curse, which immediately rebounds on Harry's Disarming Curse and kills Voldemort, who falls down lifelessly. In the movie, the curses meet again in mid-air, and upon defeat, Voldemort's body completely obliterates.
In the book, the Malfoy family has remained in the castle and is sitting uneasily among the victims and the victorious wizards, whereas in the movie, they already left Hogwarts before the last battle. Harry uses the Elder Wand to mend his own wand, and has one last talk with Dumbledore, via his portrait in the Headmaster's office, in which Harry promises not to search for the Resurrection Stone, and to leave the wand in Dumbledore's tomb (rather than destroying it), hoping, as Dumbledore had, to destroy its power by dying without ever being disarmed while in possession of it. In the movie, Harry simply snaps the Elder Wand in two, and throws away the pieces.