Approaching his 111th birthday, the Hobbit Bilbo Baggins begins writing down the full story of his adventure 60 years earlier for the benefit of his nephew Frodo.
Long before Bilbo’s involvement, the Dwarf king Thrór brought an era of prosperity for his kin under the Lonely Mountain until the arrival of the dragon Smaug. Destroying the nearby town of Dale, Smaug drove the Dwarves out of their mountain and took their hoard of gold. Thrór’s grandson, Thorin, sees King Thranduil and his Wood-elves on a nearby hillside, and is dismayed when they leave rather than aid his people, resulting in Thorin’s everlasting hatred of Elves.
In the Shire, 50-year-old Bilbo is tricked by the wizard Gandalf the Grey into hosting a party for Thorin and his company of Dwarves: Balin, Dwalin, Fíli, Kíli, Dori, Nori, Ori, Óin, Glóin, Bifur, Bofur, and Bombur. Gandalf’s aim is to recruit Bilbo as the company’s “burglar” to aid them in their quest to enter the Lonely Mountain. Bilbo is unwilling to accept at first, but has a change of heart after the company leaves without him the next day. Bilbo races to join the company. Travelling onward, the company is captured by three Trolls. Bilbo stalls the Trolls from eating them until dawn, and Gandalf exposes the trolls to sunlight, turning them to stone. The company locates the Trolls’ cave and finds treasure and Elven blades. Thorin and Gandalf each take an Elf-made blade, Orcrist and Glamdring, respectively; Gandalf also finds an Elven dagger, which he gives to Bilbo.
The wizard Radagast the Brown finds Gandalf and the company, and recounts an encounter at Dol Guldur with the Necromancer, a sorcerer who has been corrupting Greenwood with dark magic. Chased by Orcs, Gandalf leads the company through a hidden passage to Rivendell. There, Lord Elrond discloses a hidden indication of a secret door on the company’s map of the Lonely Mountain, which will be visible only on Durin’s Day. Gandalf later approaches the White Council — consisting of Elrond, Galadriel and Saruman the White — and presents a Morgul blade, a weapon of the Witch-king of Angmar, which Radagast obtained from Dol Guldur as a sign that the Necromancer is linked to an eventual return of Sauron. While Saruman presses concern to the more present matter of the Dwarves’ quest, requesting that Gandalf put an end to it, Gandalf secretly reveals to Galadriel he had anticipated this and had the Dwarves move forward without him.
The company journeys into the Misty Mountains, where they find themselves amid a colossal battle between Stone Giants. They take refuge in a cave and are captured by Goblins, who take them to their leader, the Great Goblin. Bilbo becomes separated from the Dwarves and falls into a crevice where he encounters Gollum, who unknowingly drops a golden ring. Pocketing the ring, Bilbo finds himself confronted by Gollum. They play a riddle game, wagering that Bilbo will be shown the way out if he wins or eaten by Gollum if he loses. Bilbo eventually wins by asking Gollum what he has in his pocket. Noticing his ring is lost, Gollum realizes that Bilbo possesses it and chases him. Bilbo discovers that the ring grants him invisibility, but when he has a chance to kill Gollum, Bilbo spares his life out of pity and escapes while Gollum shouts his hatred towards the hobbit Baggins.
Meanwhile, the Great Goblin reveals to the Dwarves that Azog, an Orc war-chief who killed Thrór and lost his forearm to Thorin in battle outside the Dwarven kingdom of Moria, has placed a bounty on Thorin’s head. Gandalf arrives and leads the Dwarves in an escape, killing the Great Goblin. Bilbo exits the mountain and rejoins the company, keeping his newly obtained ring secret. The company is ambushed by Azog and his hunting party, and takes refuge in trees. Thorin charges at Azog, who overpowers and severely injures him with his Warg. Bilbo saves Thorin from the Orcs and challenges Azog, just as the company is rescued by eagles implied to be sent by Galadriel. They escape to the safety of the Carrock where Gandalf revives Thorin, who renounces his previous disdain for Bilbo after being saved by him.
They see the Lonely Mountain in the distance, where a sleeping Smaug is awoken by a thrush knocking a snail against a stone.