Gandalf tricks Bilbo into hosting a party for Thorin and his band of dwarves, who sing of reclaiming the Lonely Mountain and its vast treasure from the dragon Smaug. When the music ends, Gandalf unveils a map showing a secret door into the Mountain and proposes that the dumbfounded Bilbo serve as the expedition's "burglar". The dwarves ridicule the idea, but Bilbo, indignant, joins despite himself.
The group travels into the wild, where Gandalf saves the company from trolls and leads them to Rivendell, where Elrond reveals more secrets from the map. Passing over the Misty Mountains, they are caught by goblins and driven deep underground. Although Gandalf rescues them, Bilbo gets separated from the others as they flee the goblins. Lost in the goblin tunnels, he stumbles across a mysterious ring and then encounters Gollum, who engages him in a game of riddles. As a reward for solving all riddles Gollum will show him the path out of the tunnels, but if Bilbo fails, his life will be forfeit. With the help of the ring, which confers invisibility, Bilbo escapes and rejoins the dwarves, improving his reputation with them. The goblins and Wargs give chase, but the company are saved by eagles before resting in the house of Beorn.
The company enters the black forest of Mirkwood without Gandalf. In Mirkwood, Bilbo first saves the dwarves from giant spiders and then from the dungeons of the Wood-elves. Nearing the Lonely Mountain, the travellers are welcomed by the human inhabitants of Lake-town, who hope the dwarves will fulfil prophecies of Smaug's demise. The expedition travels to the Lonely Mountain and finds the secret door; Bilbo scouts the dragon's lair, stealing a great cup and learning of a weakness in Smaug's armour. The enraged dragon, deducing that Lake-town has aided the intruder, sets out to destroy the town. A thrush had overheard Bilbo's report of Smaug's vulnerability and reports it to Lake-town defender Bard. His arrow finds the chink and slays the dragon.
When the dwarves take possession of the mountain, Bilbo finds the Arkenstone, an heirloom of Thorin's dynasty, and hides it away. The Wood-elves and Lake-men besiege the mountain and request compensation for their aid, reparations for Lake-town's destruction, and settlement of old claims on the treasure. Thorin refuses and, having summoned his kin from the mountains of the North, reinforces his position. Bilbo tries to ransom the Arkenstone to head off a war, but Thorin is intransigent. He banishes Bilbo, and battle seems inevitable.
Gandalf reappears to warn all of an approaching army of goblins and Wargs. The dwarves, men and elves band together, but only with the timely arrival of the eagles and Beorn do they win the climactic Battle of Five Armies. Thorin is fatally wounded and reconciles with Bilbo before he dies. Bilbo accepts only a small portion of his share of the treasure, having no want or need for more, but still returns home a very wealthy hobbit.