Is it possible for God to sin? Before we can answer that question we need to understand what Sin is. Sin is anything that offends God. When I say that it offends God I mean that it disrespects, elevates itself above, or goes against God or his nature. God is the standard of Good. So therefore anything and everything that is contrary to God or his nature, is evil. This idea of God being the standard of good is crutial to answering our question. Good and evil are not some standards that God is held up to. God is the standard. Here is the logic.
God is the standard of good, so therefore whatever God does is good, so therefore God can not sin.
The book of Hebrews echos this. Hebrews 6:18 - God did this so that, by two unchangeable things in which it is impossible for God to lie, we who have fled to take hold of the hope set before us may be greatly encouraged. We also know that God's nature will not change. I talk about this on the main page of this website. When the Bible says that the word of the God never changes, it is referring to his principles (not the specific laws) and his principles are set by his unchanging nature. This quite simply means that God has always been good and will continue to always be good. So we can have faith that God will never sin. We can be confident that God will not wake up someday and decide that he is now going to call evil as good and good as evil.
For God to sin, he would have to offend himself, but as 2 Timothy 2:13 tells us he can not do this. The topic of God offending himself is actually quite an interesing one, because God is three persons in one being (see the last paragraph on the main page). So can one of the three persons of the trinity do something that would offend the other two? I have had debates with people about this topic. Some Christians think that is possible. Satan certainly thought that was the case and Satan probably knows God better than any other creature, but he was wrong. The whole point of Jesus being tempted in the desert by Satan was to 1) Have the perfect man fulfill the perfect law in our place, and 2) Prove that God will not sin. Thanks to Satan, we can have faith that God has already been put to the test and passed with flying colors.
Satan waited until the most opportune time to put is theory to the test. He waited until one of the persons of the trinity was in human form (and therfore weak). He waited until that human body was at it's weakest, was tired, hungry and thirsty. Then he tried three different ways to make Jesus elevate his own desires (hunger, pride and the easy way out) over the desires of God the Father (and therefore offend God the Father). You could even say that it was scientifically proven that God won't sin. Satan made a hypothesis, he set up the experiment and then he repeated his experiment in different ways until the conclusions were overwhelmingly conclusive. It doesn't really even matter if God can or can not sin, because God has proven that he won't ever sin. It is also worth noting a few more things.