20th century atrocities
One popular argument against atheism is the observation that some of the worst atrocities of the 20th century, such as the purges of Stalin and Pol Pot, were carried out by atheists. Often, the list of atrocities includes Hitler's holocaust. While there is good reason to believe that Hitler was a theist, this does not affect the argument or its rebuttal.
To begin with, it is true that the 20th century saw many atrocities carried out on an unprecedented scale. And many of these atrocities were, in fact, carried out by atheists. So the statement as presented is true. Where it fails is in its often unstated conclusion, that atheism leads to immorality.
Often what theists are trying to say when they use this argument is that a lack of belief in God leads to a lack of morals or lack of restraint which leads to the committing of atrocities. This assumes two things. One, that God or a belief in God causes people to act morally, and that without God one acts imorrally. This must be true if you are claiming that the lack of belief caused the action. In truth you would need to posit a positive belief in order to justify a causal relationship, i.e. I don't believe in God and therefore I think it is ok to kill people. The mere "I don't believe in God" cannot by itself explain the motivation of action, what comes after it can. The logic that a person used to reach the conclusion that it is ok to kill people without God is what needs examining. However this is the point the theist is missing. And so their intial premise is contradicted by the existence of atheists who don't commit atrocities and the existence of theists who do. There must be a difference between an atheist who does commit atrocities and one who doesn't, and since that difference is not a lack of belief in God, the difference must be in their positive beliefs or their values, irrespective of their shared disbelief in God. And if belief in God does not cause people to not commit atrocities, then a lack of belief in God couldn't be said to be the cause of someone committing them.
Atheism vs. irrationality
Since atheism per se has no dogma, it is difficult to find a causal link between atheism and immoral behavior or the commission of atrocities. It is often much easier to find a cause rooted in some other belief held by the perpertrator. For example, the statement "Stalin ordered thousands of people executed because he was an atheist" is, on its face, a non sequitur. On the other hand, "Stalin ordered thousands of people executed because he thought they represented a threat to the establishment of communism", while irrational and abhorrent, at least enjoys a certain internal consistency.
Technology and population
The argument sometimes includes casualty numbers: 1.7 million people died in the Cambodian genocide , and Stalin's actions resulted in the death of at least 3 million people , to name but two examples. By contrast, one source puts the total number of casualties in all of the crusades from the 11th to 13th century at 9 million. 
However, one can no more compare raw casualty numbers in different centuries without taking population numbers and technology into account, than compare box office receipts for movies released in different decades without taking inflation into account.
Human population has been growing exponentially for thousands of years, which means that countries in the 20th century were able to raise much larger armies than in earlier centuries, simply by virtue of having a larger population.
In addition, the mass-murderers of the 20th century had access to much better technology than those of any earlier century, including gunpowder, high explosives, automatic weapons, industrialization (which permitted the manufacture of large numbers of weapons), and rapid long-distance communications (which allow coordination of combatants in different places).
In the 21st century, nineteen people were able to kill 3000 people by flying two airliners into the twin towers of the World Trade Center. Such an attack would have been impossible before the technological advances that permitted the construction of airliners and of skyscrapers capable of housing thousands of people in one place.
Thus, we must ask how many people would have died if one of the crusades had taken place with 20th or 21st century weapons. A religious war of extermination by England or France against Israel could easily involve nuclear weapons, which would most likely cause more than the nine million deaths the real crusades did.
Hitler and the Holocaust
Often, the list of 20th century genocides includes the Holocaust, and the claim that Adolf Hitler was an atheist. Although there is no reason to believe that Hitler was an atheist, and good reason to think otherwise, we may also assume, for the sake of argument, that Hitler was really an atheist who pretended to be Catholic for the purpose of misleading the German population.
We may then ask, why would he find it necessary to use religion to recruit people to help carry out his genocidal plans? If he could have swayed the population using rhetoric and propaganda, but not religion, why did he not do so? This seems to be an indictment of religion. If religion prevents immorality, why is it that it can so easily be subverted to cause people to perform immoral acts?
The idea that gulags and death camps are the end game of reason and skeptical inquiry is wrong; no atrocities are the result of being too skeptical, too reasonable, too rational, questioning the prevailing dogma or wanting evidence for claims. This argument only serves to keep the pressure away from questioning religion.
When refuted, it is made again ad nauseam. Richard Dawkins and Sam Harris both refuted the argument in their books and still a large preponderance of reviews contained the argument again as a rebuttal to their work. The argument serves as a Reductio ad Hitlerum implicitly accusing atheists of being like Nazis or Stalinists.
Atheists vs. Atheism
Atheism is the lack of belief in god(s). It contains no dogmas, rituals, actions, belief systems, tenets, etc. There is nothing about atheism which would provide a causal link between atheism and any action.
Reliance on anecdotes
Pointing out a few bad atheists does not prove a correlation between atheism and evil. There's the obvious fact that there are atheists who object to genocides and other atrocities, and the equally obvious fact that many theists are directly involved in such atrocities (many times in the Old Testament, in inquisitions, and even in the case of the Nazis, since whether or not Hitler was a theist, it's clear that other Nazis involved in supporting him and in running Holocaust were Christian).
Furthermore, Stephen Pinker has suggested that warfare between modern nation-states kills a far smaller percentage of the population than warfare in developing nations or tribal warfare. It's thus quite possible that primitive conflicts based on religious disputes were once far more brutal and efficient in wiping out whole populations than modern atrocities have been (and certain sections of the Old Testament provide biblical support for this idea, for those who care to see it). The only thing that would necessarily be worse or more notable about 20th century atrocities and genocides is that they occurred in far larger populations at once. While this hardly excuses Stalin or Pol Pot, it does suggest that they were not necessarily morally worse than some religious leaders of the past, but instead were similar people who exerted more direct control over greater populations.
- Is-ought problem - explains how justification of actions or atrocities cannot be logically based solely on facts.