Shelob is a fictional giant spider from J. R. R. Tolkien's Middle-earth legendarium. She appears at the end of the fourth book, second volume (The Two Towers), of The Lord of the Rings. Her lair lay in Cirith Ungol ("the pass of the spider") leading into Mordor. Gollum deliberately led Frodo Baggins there in hopes of recovering the One Ring when Shelob attacked Frodo. The plan was foiled when Samwise Gamgee defeated Shelob with Frodo's elvish light and sword.
Shelob was an "evil thing in spider form...[the] last child of Ungoliant to trouble the unhappy world", living high in the Ephel Dúath mountains that border Mordor. There are numerous references to her being ancient, predating the events of The Lord of the Rings by many ages. Although she resided in Mordor and was unrepentantly evil, she was independent of Sauron and his influence.
This creature makes her first appearance in the chapter "The Stairs of Cirith Ungol", though she is formally introduced in the next chapter "Shelob's Lair" where the author says "But still she was there, who was there before Sauron, and before the first stone of Barad-dûr; and she served none but herself, drinking the blood of Elves and Men, bloated and grown fat with endless brooding on her feasts, weaving webs of shadow; for all living things were her food, and her vomit darkness." Her descendants (upon whom she would often feed) include the Giant Spiders who captured and were defeated by Bilbo Baggins's Dwarf allies in Mirkwood in The Hobbit.
Shelob's lair was Torech Ungol, below Cirith Ungol ("Pass of the Spider"). It lay along the path that Sam Gamgee and Frodo Baggins took into Mordor along their route to Mount Doom. Her spider-silk, which was spun in both rope and cobweb form, was strong and cleverly made, trapping those who walked into it. Shelob had encountered Gollum during his previous trip to Mordor, and he apparently worshipped her after his fashion. The Orcs of the Tower of Cirith Ungol called her "Shelob the Great" and "Her Ladyship," and knew of Gollum's relationship with her (they referred to him as "Her Sneak"). Sauron himself was aware of her existence, but left her alone, as she was a useful guard on the pass. He occasionally sent her prisoners for whom he had no further use.
Gollum led the Hobbits into her lair so that he could get the One Ring after she consumed them, as she had no use for it. After losing track of Gollum, the Hobbits realized that the tunnel was blocked by her webs. She cornered them, but Frodo used the Phial of Galadriel's light to drive her off. Frodo then used Sting to cut the webs and the Hobbits thought that they had escaped the trap.
However Gollum waylaid the pair and tried to strangle Sam, while Shelob stung and paralysed Frodo. An enraged Sam fought off Gollum and then battled Shelob desperately using his master's sword Sting. Sam first hewed off a claw from one of her legs and stabbed out one eye (the latter being the only soft part of her body). Then he inflicted a deep gash upon her body. Seeking to crush Sam, she instead impaled herself upon Sting. Shelob's rage was rekindled and she resolved to kill Sam, but he defeated her by unleashing the light of the Phial of Galadriel, which burned and temporarily blinded her. Shelob fled into her lair, significantly wounded. Her final fate, according to the text, will remain unknown to the people of Middle-earth.
Thinking Frodo dead, Sam took the Ring from his friend and left his body behind, but discovered by listening to a pair of Orcs that Shelob normally injects a small dose of venom that was not intended to kill her victims, but only to render them unconscious and keep their meat fresh, as with lesser spiders.
As Tolkien admitted in a letter to his son, Shelob "is of course only 'she + lob'," - lob being an archaic English word for spider, influenced by Old English loppe or "spider". The word is not related to "cob" nor "cobweb". Old English attercoppe (meaning "spider") is derived from atter meaning "poison" and coppe meaning "head"; Tolkien used "attercop" as well as "cob" and "lob" in The Hobbit, where Bilbo Baggins sings songs taunting the giant spiders in Mirkwood: "Attercop, Attercop, Old Tomnoddy" and "Lazy Lob and Crazy Cob".
In Peter Jackson's film trilogy, Shelob's appearance is held over until the middle of the third movie, The Lord of the Rings: The Return of the King. In the movie, Shelob can be seen to have a retractable venomous wasp-like stinger at the rear end between the spinnerets, unlike real spiders (which inject venom with their fangs) but consistent with the book's description of Shelob. She also appears to have a gaping mouth, equipped with four chelicerae and what appears to be two teeth, whereas real spiders only possess two chelicerae and can ingest only liquid. Finally, Shelob appears to have only four eyes grouped in pairs on what looks like a face (or a flat cephalothorax), while the least number of eyes a spider can have is six. In a DVD commentary, Jackson says Shelob's appearance is mostly based on the New Zealand tunnel-web spider, which he hates.
In the video game The Return of the King, which is based on the film, Shelob is one of the bosses and her defeat is required to beat the level "Shelob's Lair". In The Lord of the Rings: The Battle for Middle-earth II, Shelob is a hireable hero-unit of the Goblin faction.
In the video game Lego The Lord of the Rings, she is the boss of the level The Secret Stairs, briefly, as Frodo and Gollum run away from her. She then appears at the start of the next level, Minas Morgul, where the player(s) can choose the characters of Samwise Gamgee or the Orc, Shagrat, since Frodo has already thrown Gollum from the top of Cirith Ungol before being stabbed by Shelob in the intervening cutscene.