According to Hitler vs. Stalin: Who Killed More?, by Timothy David Snyder, who is a history professor at Yale University specializing in eastern Europe:
Judging from the Soviet records we now have, the number of people who died in the Gulag between 1933 and 1945, while both Stalin and Hitler were in power, was on the order of a million, perhaps a bit more. The total figure for the entire Stalinist period is likely between two million and three million. The Great Terror and other shooting actions killed no more than a million people, probably a bit fewer. The largest human catastrophe of Stalinism was the famine of 1930–1933, in which more than five million people died.
Of those who starved, the 3.3 million or so inhabitants of Soviet Ukraine who died in 1932 and 1933 were victims of a deliberate killing policy related to nationality. In early 1930, Stalin had announced his intention to “liquidate” prosperous peasants (“kulaks”) as a class so that the state could control agriculture and use capital extracted from the countryside to build industry. Tens of thousands of people were shot by Soviet state police and hundreds of thousands deported. Those who remained lost their land and often went hungry as the state requisitioned food for export. The first victims of starvation were the nomads of Soviet Kazakhstan, where about 1.3 million people died. The famine spread to Soviet Russia and peaked in Soviet Ukraine. Stalin requisitioned grain in Soviet Ukraine knowing that such a policy would kill millions. Blaming Ukrainians for the failure of his own policy, he ordered a series of measures—such as sealing the borders of that Soviet republic—that ensured mass death.
In 1937, as his vision of modernization faltered, Stalin ordered the Great Terror. Because we now have the killing orders and the death quotas, inaccessible so long as the Soviet Union existed, we now know that the number of victims was not in the millions. We also know that, as in the early 1930s, the main victims were the peasants, many of them survivors of hunger and of concentration camps. The highest Soviet authorities ordered 386,798 people shot in the “Kulak Operation” of 1937–1938. The other major “enemies” during these years were people belonging to national minorities who could be associated with states bordering the Soviet Union: some 247,157 Soviet citizens were killed by the NKVD in ethnic shooting actions.
In the largest of these, the “Polish Operation” that began in August 1937, 111,091 people accused of espionage for Poland were shot. In all, 682,691 people were killed during the Great Terror, to which might be added a few hundred thousand more Soviet citizens shot in smaller actions. The total figure of civilians deliberately killed under Stalinism, around six million, is of course horribly high. But it is far lower than the estimates of twenty million or more made before we had access to Soviet sources. At the same time, we see that the motives of these killing actions were sometimes far more often national, or even ethnic, than we had assumed. Indeed it was Stalin, not Hitler, who initiated the first ethnic killing campaigns in interwar Europe.
At the war’s end the Soviets killed tens of thousands of people in their own “reprisals,” especially in the Baltic states, Belarus, and Ukraine. Some 363,000 German soldiers died in Soviet captivity.
For the Soviets during the Stalin period, the analogous figures are approximately six million and nine million.