The classic ontological argument for the existence of God runs as follows:
- God is the greatest imaginable being.
- All else being equal, a being or entity that exists is greater than one that doesn't.
- Therefore, God exists.
In this argument, existence is given as one of God's attributes as part of the definition: if X is God, then X has the property of existence. This is logically equivalent to "if X does not exist, then X is not God." It does not prove that there are any entities that actually match the definition.
Existence can hardly ever be considered an attribute, as something nonexistent cannot have attributes. Therefore, making conclusions about existence of an entity based on its properties is not logically sound. In short, this argument boils down to "show me a god, and I'll show you an existing god." It is a form of circular reasoning because the existence is built into the assumptions.
Here are some examples of this proof that highlight the fallacy.
- Let us define a unicorn as a magical equine being that has one horn, and that exists.
- By that definition, such a being must necessarily exist.
- Therefore unicorns exist.
- Shangri-La is the greatest place on earth.
- A place that exists is greater than one that doesn't.
- Therefore, Shangri-La exists.
- Hercules is the greatest warrior in history.
- A warrior that existed is greater than one that did not.
- Therefore, Hercules existed.
At best proves Pantheism:
- A being that contains all the parts of another plus one extra part is the greater being.
- There cannot exist any part that is not a part of the greatest possible being.
- Therefore, the greatest possible being encompasses the entire universe -- hence Pantheism.
- If 1. is false, there is no reason to believe that the greatest possible being encompasses anything -- the greatest possible being is indistinguishable from nothing.
- If 1. is false and 4. is false because the greatest possible being is the one that encompasses all intrinsically positive things and no intrinsically negative things, then "a being that exists is greater than one that does not" is not true unless existence is intrinsically good.
The argument also contains a converse error. The second premise amounts to "If a thing exists then it has greatness," while the conclusion assumes the reverse: "If a thing (the god) has greatness then it exists."
A comprehensive and shorter refutation can be found in positiveatheism.org 
The ontological argument was originally written by a Benedictine monk named Anselm, the Archbishop of Canterbury, in his book Proslogion in 1078. Even Anselm's contemporaries recognized its flaws; another monk, Guanilo of Marmoutiers, is remembered for using Anselm's reasoning to "prove" that the perfect island exists in On Behalf of the Fool.
A piece of parody, Gasking's Proof for the Non-existence of god is as follows:
- The creation of the universe is the greatest achievement imaginable.
- The merit of an achievement consists of its intrinsic greatness and the ability of its creator.
- The greater the handicap to the creator, the greater the achievement (would you be more impressed by Turner painting a beautiful landscape or a blind one-armed dwarf?)
- The biggest handicap to a creator would be non-existence
- Therefore if we suppose that the universe is the creation of an existing creator, we can conceive a greater being — namely, one who created everything while not existing.
- Therefore, God does not exist.
Rejection of the Second Premise
Assuming that existence and non-existence can actually be properties of something, there is no logical justification for existence being greater than non-existence