He argued that God exists not only in the intellect but also in reality - Something that can be thought to be greater than something existing only in the mind and that something than which nothing greater can be conceived therefore does not just exist in the intellect.
In other words, Something is greater if it exists in reality, rather than in the mind. E.g. A real twenty-pound note is greater than one thousand imaginary twenty pound notes. If God is the greatest thing imaginable, He must exist, for if he didn't, you could imagine something greater - something with all his qualities that did actually exist.
Anselm said that existence is a necessary part of the idea of God. Factual necessity implies that is impossible for things to be as they are if God didn't exist. Therefore it is actually not possible for there to be no God. God is a necessary being, and a necessary being cannot NOT exist. Also, a being that possesses necessary existence will always be greater than a contingent being, which may or may not have existed.
Descartes developed Anselm's argument, but he defines God as,.
"A supremely perfect being.".
Descartes began by doubting everything, including truths that he had already previously accepted to be true. He wouldn't accept empirical evidence to prove something true. He believed that our senses could deceive us. What we think we are experiencing, could be a dream or an hallucination or false experience, caused by a, "malicious demon.".
His doubt of everything included doubt of his own existence. He decided that the only certainty was doubt itself.
He realised that the only thing he couldn't doubt were his own thoughts. Even if he was dreaming, he was still thinking. Even if he didn't really have a body, he was still thinking.
He famously said,.
"I think, therefore I am.".
Descartes had proved his own existence, but not of the outside world. In order to do so, he said that he needed to prove the existence of God.