Who is the greatest wizard: Gandalf, Merlin or Dumbledore?: originally appeared on Quora: The best answer to any question. Ask a question, get a great answer. Learn from experts and access insider knowledge. You can follow Quora on Twitter, Facebook, and Google+.
I'm going to start with a literary, rather than a fanboy (Do you think the Thing could beat the Hulk?) approach to this. I'm also completely ignoring television and movies and sticking to written sources.
Merlin and Gandalf are not characters from novels in the literary sense, but from legends. Merlin is undoubtedly legendary, and The Lord of the Rings, in which Gandalf appears, was intentionally written in a legendary style. This accounts for the two-dimensionality of most of its characters and their lack of growth. Dumbledore, on the other hand, belongs to the modern naturalistic convention of storytelling and the works in which he appears are novels -- albeit children's novels, which puts them in a special category.
As a result, it's difficult to judge their characters. Merlin has almost none. All we know about him is that he was loyal to Uther and Arthur and in his later years he was trapped by Nimuë. Gandalf is more fully fleshed-out, but as an immortal, he's not a normal person. He has limits, but seemingly no personal weaknesses apart from a short temper. Dumbledore is a three-dimensional human being.
What, then, is a "great" wizard? Setting aside raw power, presumably it's the same as greatness in anyone else: the size of his deeds relative to his abilities and his degree of self-sacrifice.
Merlin is really only responsible for two or three works of magic: disguising Uther Pendragon so that he could have sex with his enemy Gorlois's wife Ygraine, and moving Stonehenge from Ireland to England. He may also have made Excalibur's magical scabbard, which protected the wearer from harm. His activities were confined to supporting his king. Merlin wasn't really a great wizard.
Gandalf is greater than Dumbledore although (or perhaps because) he had less power. He rallied all the free peoples of Middle-Earth to the cause, gave them heart, and sacrificed himself to save his friends and the quest in Moria. He worked tirelessly for centuries.
Dumbledore was not really a leader of anything besides Hogwarts; he did not rally whole nations against Voldemort. He gave up his life, but only because he had been cursed. It was more suicide than self-sacrifice. Doing so did not achieve anything positive.
Dumbledore is the most powerful by a country mile for the simple reason that magic has changed as the world has changed, so what might have seemed like a big deal in 600 A.D., or even 1954, does not seem like a big deal now, and J.K. Rowling wanted to "wow" her audience. Also, Tolkien was deliberately vague about magic and quite intentionally distinguished it from technology; it was not something one called upon at whim. Rowling's magic is indistinguishable from advanced technology and is used with the same ease and facility as technology. Dumbledore has access to a vast array of spells and magical devices that do all kinds of useful things. We saw Gandalf do a limited number of things, although some were quite dramatic: he started fires, closed a door, smashed a stone bridge, fought a demon, and faced down an evil wraith. But he can't do a fraction of the things that Dumbledore can.
As for who can beat whom?
Merlin's magic was not offensive, so he's largely out of the picture. Gandalf would have approached beating Voldemort quite differently; he would have aroused both the wizarding and the Muggle world against Voldemort as he did in Middle-Earth, using his special powers of persuasion and encouragement. But he didn't possess the kind of spells that could beat Voldemort in combat.
Dumbledore could not have beaten Sauron in combat for the same reason: he lived in a world of humans, not immortal beings of immense spiritual power. His spells were not the right sort. However, he did have one ace in the hole that would have made the whole enterprise far easier: the Fidelius Charm. He could have hidden Frodo and the Ring utterly beyond anyone's ability to find them. They could have walked straight in the Black Gate. Harry's invisibility cloak would have been handy also, as it made one invisible without the drawbacks of the Ring.