The story is about the hobbit Bilbo Baggins, who is taken from his simple life by the wizard Gandalf, to go on an adventure. Together with a group of Dwarves they travel to the Lonely Mountain, to reclaim the Dwarves' home and treasure from the dragon Smaug.
The Hobbit was conceived by Tolkien as a story for his children. It became his first published fiction book. When asked for more stories about the hobbits, he began to write a sequel, which would later become The Lord of the Rings.
The Hobbit was at first not part of his Middle-earth world. Having begun to write the sequel, Tolkien set both the Hobbit and Lord of the Rings stories into his Middle-earth world. Because of this he made some changes in later editions, mostly concerning Gollum and the Ring. In the story of the Middle-earth legendarium, The Hobbit as Bilbo's story of his journey and the finding of the Ring, and The Lord of the Rings as Frodo's later additions from the War of the Ring together form the Red Book of Westmarch.
Although Tolkien imagined the Hobbit as a tale for his children, the book became popular for children and adults alike.
The hobbit Bilbo Baggins is used to living a quiet and peaceful life. One day the wizard Gandalf comes to him, who introduces him to a group of thirteen Dwarves: the leader Thorin Oakenshield, his two nephews Fíli and Kíli, Óin, Glóin, Balin, Dwalin, Dori, Nori, Ori, Bifur, Bofur, and Bombur. From them he learns their story: A long time ago their people lived in the Lonely Mountain, rich and prosperous, ruled by the King under the Mountain, Thorin's grandfather. But then the dragon Smaug came to the Lonely Mountain, killed most of the dwarves, and took their treasures and their home for himself. Years later, Thorin now wants to return to the Lonely Mountain, to reclaim what's rightfully theirs; Gandalf recommended Bilbo to the dwarves as a "Burglar" to take on their quest. Bilbo is confused and adverse to leaving his home, but is later convinced to follow the group.
Gandalf, the dwarves, and Bilbo set out towards the east on their journey to the Lonely Mountain. Along the way they are captured by three trolls, but Gandalf saves them. In the troll's hideout they find some gold and swords, and Gandalf, Thorin, and Bilbo each take one. The group continues to the Elven city Rivendell, where its master, Elrond, provides them with valuable information.
As the group travels over the Misty Mountains, goblins attack and capture them, taking them into their caves under the Mountains. Gandalf, who had evaded capture, comes to their rescue, but the group loses Bilbo on their flight. Wandering through the dark, Bilbo stumbles upon a ring, which he puts in his pocket. By an underground lake Bilbo meets the creature Gollum, who offers to show him the way out if he can best him in a game of riddles, otherwise he will eat him. Running out of riddles to ask, Bilbo absentmindedly finds the ring in his pocket and wonders aloud: "What have I got in my pocket?". Gollum, believing it to be a riddle, is unable to answer, and loses the game. But Gollum, angry and unwilling to help, goes off to fetch his "birthday present": a magical ring, which turns its wearer invisible. Unable to find it, he believes Bilbo has it, and chases Bilbo. While running away and falling, the ring slips on Bilbo's finger and he becomes invisible, causing Gollum to run past him towards the way out of the caves. Bilbo realizes both and follows Gollum. When he finds Gollum blocking his way out, he thinks he might have to kill the creature who still cannot see him. But Bilbo has pity on him, and with a great effort manages to jump over Gollum's head, sparing his life and yet managing to save his own. Out of the caves, Bilbo rejoins Gandalf and the dwarves.
While moving away from the Mountains the group is attacked by goblins and wargs but saved by the Great Eagles, who fly them to their eyries and later away from the Mountains. The group comes to the home of Beorn, a big man able to shapeshift into a bear; after a short stay they continue to the forest Mirkwood. At the border, Gandalf unexpectedly bids them good-bye, and the group has to go on alone. After having traveled for a time the dwarves are attacked and captured by giant spiders, but with the help of the ring and his sword, Bilbo can free them, after which he names his sword Sting. But immediately after, the dwarves are captured by Wood-elves and taken to their underground home. Using the ring, Bilbo frees the dwarves from the dungeons and puts them into barrels used to trade goods. The barrels are let swim down a river out of Mirkwood, made into a float, and then come to the Long Lake near the Lonely Mountain. The group are welcomed by the people of the human settlement Lake-town.
The dwarves and Bilbo travel up the Lonely Mountain, and manage to find and open the secret door leading into it. Calling him on the job he has been hired for, the dwarves send a terrified Bilbo into the mountain. Bilbo comes to the dragon's lair, takes a golden cup, talks to the dragon, and learns his one weak spot. Smaug, believing the people of Lake-town responsible for helping the intruders, sets out to destroy it. A thrush who had overheard Bilbo telling the dwarves, reports the dragon's vulnerable spot to Bard the Bowman, who is able to shoot Smaug, although a great part of Lake-town is destroyed.
The dwarves are rejoicing in retaking their old home, and send messages to others of their people to join them. Bilbo finds and takes the Arkenstone, a gem greatly valued by Thorin. But the peace is short-lived as soon the people from Lake-town and an army from Mirkwood arrive, both parties laying claim to part of the dwarves' treasure. Thorin refuses them, and the humans and elves start a siege of the Lonely Mountain. The situation becomes even more tense after the arrival of Thorin's relative Dáin II Ironfoot with an army of dwarves. Bilbo sneaks off at night to give the sieging party the Arkenstone as a bargaining chip, hoping to prevent bloodshed. When he is offered the Arkenstone in exchange for part of the treasure, Thorin remains adamant and furiously rejects and curses Bilbo.
Just when there seems no way out, Gandalf reappears to warn of an approaching army of Goblins and Wargs. The dwarves, men, and elves band together against their common enemy, resulting in the Battle of Five Armies, which they manage to win, with the help of the Eagles and Beorn. Thorin's nephews Fíli and Kíli are killed, and Thorin himself is mortally wounded. He dies after the battle, but lives long enough to reconcile with Bilbo, whom he now holds in high regard and as a dear friend. Dáin becomes King under the Mountain, and parts of the dwarves' treasure are rewarded to the involved parties. In the end Bilbo returns home, richer and grown for his experiences, and lives happily thereafter.