Thousands of years before the events of the novel, the Dark Lord Sauron had forged the One Ring to rule the other Rings of Power and corrupt those who wore them: the leaders of Men, Elves and Dwarves. Sauron was defeated by an alliance of Elves and Men led by Gil-galad and Elendil, respectively. Isildur, son of Elendil, cut the One Ring from Sauron's finger, causing Sauron to lose his physical form. Isildur claimed the Ring as an heirloom for his line, but when he was later ambushed and killed by the Orcs, the Ring was lost in the River Anduin at Gladden Fields.
Over two thousand years later, the Ring was found by one of the river-folk called Déagol. His friend Sméagol fell under the Ring's influence and strangled Déagol to acquire it. Sméagol was banished and hid under the Misty Mountains. The Ring gave him long life and changed him over hundreds of years into a twisted, corrupted creature called Gollum. Gollum lost the Ring, his "precious", and as told in The Hobbit, Bilbo Baggins found it. Meanwhile, Sauron assumed a new form and took back his old realm of Mordor. When Gollum set out in search of the Ring, he was captured and tortured by Sauron. Sauron learned from Gollum that "Baggins" of the Shire had taken the Ring. Gollum was set loose. Sauron, who needed the Ring to regain his full power, sent forth his powerful servants, the Nazgûl, to seize it.
The story begins in the Shire, where the hobbit Frodo Baggins inherits the Ring from Bilbo Baggins, his cousin and guardian. Neither hobbit is aware of the Ring's nature, but Gandalf the Grey, a wizard and an old friend of Bilbo, suspects it to be Sauron's Ring. After Gandalf confirms his suspicions, he tells Frodo the history of the Ring and counsels him to take the Ring away from the Shire. Frodo leaves the Shire, in the company of his gardener and friend, Samwise ("Sam") Gamgee, and two cousins, Meriadoc Brandybuck, called Merry, and Peregrin Took, called Pippin. They are nearly caught by the Black Riders while in the Shire, but they shake off pursuit by cutting through the Old Forest. There, they are aided by Tom Bombadil, a strange and merry fellow who lives with his wife Goldberry in the forest. Surprisingly, the Ring has no power over him.
The Hobbits leave the Old Forest and reach the town of Bree, where Gandalf is expected to meet them. Instead, they meet a Ranger named Strider, whom Gandalf had mentioned in a letter. Strider persuades the hobbits to take him on as their guide and protector. Together, they leave Bree after another close escape from the Black Riders. On the hill of Weathertop, they are again attacked by the Black Riders, who wound Frodo with a cursed blade. Strider fights off the Black Riders with fire and leads the hobbits towards the Elven refuge of Rivendell. Frodo falls deathly sick from the wound. The Black Riders nearly overtake Frodo at the Ford of Bruinen, but flood waters summoned by Elrond, master of Rivendell, rise up and overwhelm them.
Frodo recovers in Rivendell under the care of Elrond. The Council of Elrond speaks of the history of Sauron and the Ring. Strider is revealed to be Aragorn, the heir of Isildur. Gandalf reveals that Sauron has corrupted Saruman, chief of the wizards. The Council decides that the Ring must be destroyed, but that can only be done by sending it to the Fire of Mount Doom in Mordor, where it was forged. Frodo takes this task upon himself. Elrond, with the advice of Gandalf, chooses companions for him. The Company of the Ring are nine in number: Frodo, Sam, Merry, Pippin, Aragorn, Gandalf, Gimli the Dwarf, Legolas the Elf, and the Man Boromir, son of the Ruling Steward Denethor of the land of Gondor.
After a failed attempt to cross the Misty Mountains through the Redhorn Pass across the flank of Caradhras, the Company are forced to try a dangerous path through the Mines of Moria. They are attacked by the Watcher in the Water before the doors of Moria. Inside Moria, they learn of the fate of Balin and his colony of Dwarves. After surviving an attack, they are pursued by Orcs and by an ancient demon called a Balrog. Gandalf faces the Balrog, and both of them fall into the abyss. The others escape and find refuge in the Elven forest of Lothlórien, where they are counselled by Galadriel and Celeborn.
With boats and gifts from Galadriel, the Company travel down the River Anduin to the hill of Amon Hen. Boromir tries to take the Ring from Frodo, but Frodo puts on the Ring and disappears. The Company is scattered in the panic to find Frodo, and they are attacked by Orcs. Frodo chooses to go alone to Mordor. Sam guesses Frodo's mind, and goes with him.
Orcs sent by Saruman and Sauron kill Boromir and take Merry and Pippin. Aragorn, Gimli and Legolas debate amongst themselves which pair of hobbits to follow. They decide to follow the Orcs bearing Merry and Pippin to Saruman. In the kingdom of Rohan, the Orcs are slain by a company of the Rohirrim. Merry and Pippin escape into Fangorn Forest, where they are befriended by Treebeard, the oldest of the tree-like Ents. Aragorn, Gimli and Legolas track the hobbits to Fangorn. There they unexpectedly meet Gandalf. Gandalf explains that he slew the Balrog; darkness took him, but he was sent back (to Middle-earth). He is clothed in white and is now "Gandalf the White", for he has taken Saruman's place as the chief of the wizards. Gandalf assures his friends that Merry and Pippin are safe. Together they ride to Edoras, capital of Rohan. Gandalf frees Théoden, King of Rohan, from the influence of Saruman's spy Gríma Wormtongue. Théoden musters his fighting strength and rides with his men to the ancient fortress of Helm's Deep, while Gandalf departs to seek help from Treebeard.
Meanwhile, the Ents, roused by Merry and Pippin from their peaceful ways, attack Isengard, Saruman's stronghold, and trap the wizard in the tower of Orthanc. Gandalf convinces Treebeard to send an army of Huorns to Théoden's aid. Gandalf brings an army of Rohirrim to Helm's Deep, and they defeat the Orcs, who flee into the waiting shadow of the trees. Gandalf visits Saruman, offering him a chance to turn away from evil. When Saruman refuses to listen, Gandalf strips him of his rank and most of his powers. Pippin picks up a palantír, a seeing-stone that Saruman used to speak with Sauron and through which Saruman was ensnared, and is seen by Sauron. Gandalf rides for Minas Tirith, chief city of Gondor, taking Pippin with him.
Frodo and Sam capture Gollum, who had been following them from Moria. They force him to guide them to Mordor. They find that the Black Gate of Mordor is too well guarded, so instead they travel to a secret way Gollum knows. On the way, they encounter Faramir, who, unlike his brother Boromir, resists the temptation to seize the Ring. He provides Frodo and Sam with food. Gollum — who is torn between his loyalty to Frodo and his desire for the Ring — betrays Frodo by leading him to the great spider Shelob in the tunnels of Cirith Ungol. Frodo falls when pierced by Shelob's sting. But with the help of Galadriel's gifts, Sam fights off the spider. Believing Frodo to be dead, Sam takes the Ring in the hope of finishing the quest alone. Orcs find Frodo, and from their words Sam becomes aware that Frodo is yet alive. The Orcs take Frodo's body, and Sam chases after them, entering Mordor alone.
Sauron sends a great army against Gondor. Gandalf arrives at Minas Tirith to warn Denethor of the attack, while Théoden leads the Rohirrim to the aid of Gondor. Minas Tirith is besieged. Denethor is deceived by Sauron and falls into despair. He burns himself alive on a pyre, nearly taking his son Faramir with him. Aragorn, accompanied by Legolas, Gimli and the Rangers of the North, takes the Paths of the Dead in the hopes of bringing the Dead to his aid, for the Dead Men of Dunharrow are bound by a curse by which they are given no rest until they fulfil their oath to fight for the King of Gondor. With the coming of Aragorn, the Army of the Dead fulfil their oath and strike terror into the Corsairs of Umbar invading southern Gondor. Aragorn defeats the Corsairs and takes their ships, which he uses to bring the men of southern Gondor up the Anduin, coming just in time to the aid of Minas Tirith. Éowyn, Théoden's niece whom he loves as a daughter, slays the Lord of the Nazgûl with help from Merry. Théoden is slain and Éowyn and Merry are injured. Together Gondor and Rohan defeat Sauron's army in the Battle of the Pelennor Fields.
Meanwhile, Sam rescues Frodo from the tower of Cirith Ungol. They set out across Mordor. Aragorn leads an army of men from Gondor and Rohan to march on the Black Gate of Mordor, so as to distract Sauron from his true danger. His army is vastly outnumbered by the great might of Sauron. Frodo and Sam reach the edge of the Cracks of Doom, but Frodo cannot resist the Ring any longer. Frodo claims the Ring for himself and puts it on his finger. Gollum suddenly reappears, having caught up with the hobbits. He struggles with Frodo and bites off Frodo's finger with the Ring on it. Celebrating wildly, Gollum loses his footing and falls into the Fire, taking the Ring with him. The Ring is destroyed, and Sauron loses his power forever. The Nazgûl perish, and Sauron's armies are thrown into such disarray that Aragorn's forces emerge victorious.
Aragorn is crowned Elessar, King of Arnor and Gondor, and weds Arwen, daughter of Elrond. The four hobbits make their way back to the Shire, only to find out that the Shire has been enslaved by bad men. The hobbits raise a rebellion and overthrow the men, who turn out to be led by Saruman. Frodo does not allow the hobbits to kill Saruman, but Gríma turns on Saruman and kills him in front of Bag End (Frodo's hobbit-hole). He is slain in turn by hobbit archers, and the War of the Ring comes to its true end on Frodo's very doorstep.
Merry and Pippin are celebrated as heroes. Sam marries Rosie Cotton and uses his gifts from Galadriel to help heal the Shire. But Frodo is still wounded in body and spirit, having borne the Ring for so long.
In the appendices, Sam gives his daughter Elanor the Red Book of Westmarch, which contains the story of Bilbo's adventures and the War of the Ring as told by the hobbits. Sam is then said to have crossed west over the Sea himself, the last of the Ring-bearers