Humphrey Carpenter in his 1977 biography relates that Tolkien owned a postcard entitled Der Berggeist ("the mountain spirit"), and on the paper cover in which he kept it, he wrote "the origin of Gandalf". The postcard reproduces a painting of a bearded figure, sitting on a rock under a pine tree in a mountainous setting. He wears a wide-brimmed round hat and a long red cloak, and a white fawn is nuzzling his upturned hands.
Carpenter said that Tolkien recalled buying the postcard during his holiday in Switzerland in 1911. Manfred Zimmerman, however, discovered that the painting was by German artist Josef Madlener and dates to the mid–1920s. Carpenter acknowledged that Tolkien was probably mistaken about the origin of the postcard.
The original painting was auctioned at Sotheby's in London on 12 July 2005 for 84,000 GBP. The previous owner had been given the painting by Madlener in the 1940s and recalled that Madlener said the mountains in the background were the Torri del Vaiolet, peaks of Dolomites.
When writing The Hobbit in the early 1930s Tolkien gave the name Gandalf to the leader of the dwarves, the character later called Thorin. The name is taken from the same source as all the other Dwarf names (save Balin) in The Hobbit: the "Catalogue of Dwarves" in the Völuspá. He came to regret his decision, calling it a "rabble of eddaic-named dwarves, … invented in an idle hour".
The wizard that was to become Gandalf was originally named Bladorthin. Tolkien later assigned this name to an ancient king who had ordered some spears from the dwarves. The Old Norse name Gandalfr incorporates the words gandr meaning both "wand" and (especially in compounds) "magic" and alfr meaning "elf" or in a wider sense "(mythological) being". Hence Gandalf means roughly "magic–elf/being" or wizard. This may have led Tolkien to transfer the name from the leader of the dwarves to the wizard.
Throughout the early drafts, and through to the first edition of The Hobbit Bladorthin/Gandalf is described as being a 'little old man', distinct from a dwarf, but not of the full human stature that would later be described in The Lord of the Rings. Even in The Lord of the Rings, Gandalf was not tall; shorter, for example, than Elrond or the other wizards.
Tolkien refers to Gandalf as an 'angel incarnate' in a letter of 1954. In the same letter Tolkien states he was given the form of an old man in order to limit his powers on earth. Both in 1965 and 1971 Tolkien again refers to Gandalf as an angelic being.
In a letter of 1946 Tolkien stated that he thought of Gandalf as an "Odinic wanderer". Other commentators have also compared Gandalf to the Norse god Odin in his "Wanderer" guise – an old man with one eye, a long white beard, a wide brimmed hat, and a staff.
Gandalf's relationship with Saruman, the head of the Order, was strained. The Wizards were commanded to aid Men, Elves, and Dwarves, but only through counsel; it was forbidden to use force to dominate them – an injunction Saruman disregarded.
Gandalf returned to Dol Guldur in "at great peril" and learned that the Necromancer was indeed Sauron returned. (This is when Gandalf found Thráin the Dwarf imprisoned in Dol Guldur and recovered the map and key to Erebor before Thráin died.) The following year the White Council was summoned, and Gandalf urged that Sauron be driven out. Saruman however reassured the Council that Sauron's evident desire to find the Ring would fail, as the Ring would long since have been carried by Anduin to the Sea; and the matter was allowed to rest. But at this time Saruman himself began actively seeking the Ring near the Gladden Fields where Isildur had been killed, not far from Dol Guldur.
The chapter 'Istari', initially written as part of the Appendices of The Lord of the Rings, develops the history of Gandalf, and his place in Tolkien's wider fiction.
In ,, Gandalf the Grey arranged (and frequently accompanied) a band of thirteen dwarves and the Hobbit Bilbo Baggins to reclaim from the dragon Smaug the Dwarves' lost treasure in Erebor. To the quest, Gandalf contributed a map and key to Erebor, which he had received from Thráin II while exploring the dungeons of the Necromancer. It was on this Quest of Erebor that Gandalf found his sword, Glamdring, in a troll's treasure hoard, and that Bilbo found the One Ring (though at the time it was thought to be a lesser ring).
After escaping from the Misty Mountains pursued by Orcs and Wargs, the party was carried to safety by the Great Eagles. Gandalf then devised a clever plan to convince the king of the Beornings, Beorn — who did not like uninvited guests or dwarves — to house and provision the company for the trip through Mirkwood.
Gandalf left the company before they entered Mirkwood, saying that he had pressing business to attend to. He turned up again, however, before the walls of Erebor disguised as an old man, revealing himself when it seemed the Men of Esgaroth and the Elves of Mirkwood would fight Thorin and the Dwarves over Smaug's treasure. The Battle of the Five Armies ensued when hosts of Goblins and Wargs attacked all three parties. After the battle, Gandalf accompanied Bilbo back to the Shire, revealing at Rivendell what his pressing business had been: Gandalf had once again urged the Council to evict Sauron, since quite evidently Sauron did not require the Ring to continue to attract evil to Mirkwood. Then, in an event only tantalizingly briefly described (in The Silmarillion, The Hobbit, and The Lord of the Rings), the Council "put forth its power" and drove Sauron from Dol Guldur. But Sauron had anticipated this and withdrew as a feint, only to reappear in Mordor.
He returned to the Shire for Bilbo's "eleventy-first" (111th) birthday party, bringing many fireworks for the occasion. After Bilbo, as a prank on his guests, put on the Ring and disappeared, Gandalf strongly encouraged his old friend to leave the Ring to Frodo, as they had planned. Bilbo became hostile and accused Gandalf of trying to steal the Ring — which he called "my precious", much as Gollum, the previous owner of the Ring, had done. (Isildur, who earlier possessed the ring and was destroyed by it, had written that "it is precious to me"). Alarmed, Gandalf impressed on Bilbo the foolishness of this accusation. Coming to his senses, Bilbo admitted that the Ring had been troubling him, and leaving it behind for Frodo, he departed for Rivendell. Though Bilbo would never be entirely free of the desire for the Ring, he was the first to give it up willingly.
Over the next seventeen years, Gandalf travelled extensively, searching for answers. With Aragorn he sought to find Gollum. Aragorn eventually succeeded, and Gandalf questioned Gollum, threatening him with fire when he proved unwilling to speak. Gandalf learned finally that Sauron had forced Gollum under torture in Barad-dûr to tell what he knew of the Ring. This reinforced Gandalf's growing suspicion that Bilbo's ring was the One Ring.
Returning to the Shire, in , Gandalf confirmed his suspicions by throwing the Ring into Frodo's hearth fire and reading the writing that appeared on the Ring's surface. He told Frodo the full history of the Ring, and urged him to take the Ring to Rivendell; for he would be in grave danger if he stayed in the Shire. Gandalf said he would attempt to return for Frodo's fiftieth birthday party, in order to accompany him on the road thereafter; and that meanwhile Frodo should arrange to leave quietly, as the servants of Sauron would be searching for him.
Outside the Shire, Gandalf encountered Radagast the Brown, another of the Istari, who brought the news that the Nazgûl had ridden forth and crossed the River Anduin — and a request from Saruman that Gandalf come to Isengard. Gandalf left a letter to Frodo (urging his immediate departure) with Barliman Butterbur at the inn in Bree, and headed towards Isengard. There Saruman revealed his true colours, urging Gandalf to help him obtain the Ring for his own use. Gandalf refused, and Saruman imprisoned him at the top of the tower of Orthanc. Eventually Gandalf was rescued by Gwaihir the Eagle.
Gwaihir set Gandalf down in Rohan, where Gandalf appealed to King Théoden for a horse. Théoden, under the baleful influence of Gríma Wormtongue, Saruman's spy, told Gandalf to take any horse he pleased, but to leave quickly. It was then that Gandalf met the great horse Shadowfax, one of the mearas, who would be his mount and companion for most of the rest of the war. Gandalf pursued the horse for two days before Shadowfax permitted Gandalf to ride him. Gandalf then rode hard for the Shire, but did not reach it until Frodo had already set out. Knowing that Frodo and his companions would be heading for Rivendell, Gandalf began to make his own way there. He learned at Bree that the hobbits had fallen in with Aragorn. He faced the Nazgûl at Weathertop but escaped after an all-night battle, drawing four of them northward. Frodo, Aragorn and company faced the remaining five on Weathertop a few nights later. Gandalf reached Rivendell just before Frodo's arrival.
In Rivendell, Gandalf helped Elrond drive off the Nazgûl pursuing Frodo and played a great part in the following council as the only person who knew the full history of the Ring. He also revealed that Saruman had betrayed them and was in league with Sauron. When it was decided that the Ring had to be destroyed, Gandalf volunteered to accompany Frodo – now the Ringbearer – in his quest. He also persuaded Elrond to let Frodo's cousins Merry and Pippin join the Fellowship.
Taking charge of the Fellowship (comprising nine representatives of the free peoples of Middle-earth, "set against the Nine Riders"), Gandalf and Aragorn led the Hobbits and their companions south. After an unsuccessful attempt to cross Mount Caradhras in winter, they crossed under the mountains through the Mines of Moria, though only Gimli the Dwarf was enthusiastic about that route. In Moria, they discovered that the Dwarf colony established there earlier had been overrun by Orcs. The Fellowship fought with the Orcs and Trolls of Moria, but were no match against "Durin's Bane," a Balrog from ancient times. At the Bridge of Khazad-dûm, Gandalf faced the Balrog to enable the others to escape.
After a short exchange of blows, Gandalf broke the bridge beneath the Balrog with his staff. As the Balrog fell, it wrapped its whip around Gandalf's knees, dragging him into the abyss. As his friends looked on in horror, Gandalf fell into shadow, crying "Fly, you fools!" as he went.
Neither Gandalf nor the Balrog was killed by the fall into the deep underground lake under Moria. Gandalf pursued the Balrog for eight days until they climbed to the peak of Zirakzigil. Here they fought for two days and nights. In the end, the Balrog was cast down and broke the mountainside with its fall. Gandalf himself died during this ordeal, and his body lay on the peak while his spirit travelled outside of time.
They travelled to Rohan, where Gandalf found that Théoden had been further weakened by Wormtongue's influence. He broke Wormtongue's hold over Théoden, and convinced the king to join in the fight against Sauron. Gandalf then set off to gather Erkenbrand of the Westfold and his warriors to assist Théoden in the coming battle with Saruman. Gandalf arrived just in time to shatter Saruman's attack on Helm's Deep. After the ensuing battle, Gandalf and the king rode to Isengard, which in the interim had itself been attacked and conquered by Treebeard and the Ents, along with Merry and Pippin. Gandalf broke Saruman's staff and expelled him from the White Council and the Order of Wizards, and assumed Saruman's place as head of both. Wormtongue made an indecisive attempt to kill Gandalf or Saruman with the palantír of Orthanc, but missed both. Pippin retrieved the palantír, but Gandalf quickly appropriated it. After the group left Isengard, Pippin took the palantír from a sleeping Gandalf, looked into it, and came face to face with Sauron himself. Gandalf then took the chastened Pippin with him to Minas Tirith to keep the young Hobbit out of further trouble.
Gandalf arrived in time to help order the defences of Minas Tirith. His presence was resented by Denethor, the Steward of Gondor; but after Denethor's son Faramir was gravely wounded in battle, Denethor sank into despair and madness. Together with Prince Imrahil of Dol Amroth, Gandalf led the defenders during the siege of the city. When the forces of Mordor finally broke the main gate, Gandalf alone on Shadowfax confronted the Witch-king of Angmar, Lord of the Nazgûl. But at that moment the Rohirrim arrived, compelling the Witch-king to withdraw and engage them. Gandalf would have ridden to their aid, but he too was suddenly required elsewhere — to save Faramir from the now-insane Denethor, who sought to burn himself and his son on a funeral pyre.
Aragorn and Gandalf then led the final campaign against Sauron's forces at the Black Gate, in an effort to distract the Dark Lord's attention from Frodo and Samwise Gamgee, who were at the same moment scaling Mount Doom to destroy the Ring. In a parlay before the battle, Gandalf and the other leaders of the West met the Mouth of Sauron, who showed them Frodo's mithril (silver-steel) shirt and other items from the Hobbits' equipment. But Gandalf rejected Mordor's terms of surrender, and the forces of the West faced the full might of Sauron's armies, until the Ring was destroyed in Orodruin. Gandalf led the Eagles to rescue Frodo and Sam from the eruption of Orodruin.
After the war, Gandalf crowned Aragorn as King Elessar, and helped him find a sapling of the White Tree of Gondor. He accompanied the Hobbits back to the borders of the Shire, before leaving to visit Tom Bombadil. Three years later, Gandalf — who by now had spent about 2,000 years in Middle-earth — departed with Frodo, Bilbo, Galadriel, and Elrond across the sea to the Undying Lands. It was only then that his possession of a Ring of Power became generally known.
Within the Tolkien legendarium, "Gandalf" translates an unknown name of the meaning "Wand-Elf (alternatively cane/staff)".
Sir Ian McKellen portrayed Gandalf in the Lord of the Rings movie trilogy directed by Peter Jackson. The make-up and costumes were based on designs by John Howe and Alan Lee. At the time he was cast, McKellen had never read any of Tolkien's works, but he quickly developed his knowledge of The Lord of the Rings and made his performance as close to the original source as possible. For his performance in The Fellowship of the Ring, McKellen won a Saturn Award and a Screen Actors Guild Award for Best Supporting Actor and was also nominated for an Academy Award of the same category, making him the only individual cast member to be nominated. On his personal web site, McKellen has said he would be delighted to reprise the role in The Hobbit and its sequel, should Peter Jackson be involved, which he is, as the executive producer.
In the Battle of Five Armies (2005), also published by Games Workshop, Gandalf has the highest command value of any Good commanders.
Gandalf was portrayed by Tom Stiver in productions of The Two Towers (2002), and The Return of the King (2003) for Clear Stage Cincinnati in the United States. At Chicago's Lifeline Theatre, Gandalf was played by Charles Picard in The Two Towers (1999).