First, we have to understand that this is a subjective question. There is no objective way to determine what is or is not moral.
Second, in order to answer this, we must in some way define what we will say is moral. In this situation, I would say that the use of the bombs was moral if, on balance, they caused less suffering than would have happened had they not been used. Using this definition, I would argue that using the bombs was moral. However, there is no way to prove this.
If the bombs had not been used, the war would have continued. It is likely that the US would have had to invade Japan. The Soviet Union might have participated in the invasion. If these things had happened, there would have been at least two consequences. First, huge numbers of people, both Japanese and Allied, would have died. Many more people would surely have died in an invasion than were killed by the bombs. Second, if the Soviet Union had participated in the invasion, part of Japan would likely have become Soviet territory after the war just as part of Korea did. The people in that part of Japan would have been forced to live under Soviet rule.
Thus, it seems likely that more people would have died if the bombs had not been dropped. Additionally, some of the survivors would likely have lived under a brutal dictatorship as North Koreans do today. This seems to indicate that the use of the bombs was, on the whole, moral.
Controversies have arose over the moral nature of using atomic bombs to end the war against Japan, thus killing millions of innocent civilians. Such actions seemed to represent an attempt by the US to impose total control over Japan. Others have also claimed that there were other morally preferable ways to end the war in the Pacific. However, these claims are more than unjustified since it suggests that the morally better way to end the war was to continue relying on the Allied blockade, which would have starved the Japanese masses to death. Similarly, a bombing offensive was impossible as most of the infrastructure in Japan was already gone - in fact, Hiroshima and Nagasaki had been chosen as the targets as they were the only cities that were relatively intact in Japan. Any attempt to invade Japan would have only resulted in an Asia-wide bloodbath and a staggering number of casualties, prolonging the war. Therefore, there seemed to be no other viable alternatives to turn to, which could provide a quick end.
In evaluating whether the decision made by the US was the right one, one had to consider the fact that the circumstances or context in which the decision was made then were different from those of today. The world itself had been brutalized by prolonged fighting and had grown to accept a set of norms in warfare. They were thus able to agree with the notion that one final strike with a stronger weapon was not unreasonable. Submerged in so many years of total war, the atomic weapons appeared to be a viable option to end the war quickly, and in the eyes of the Allies, the fear of Japanese casualties was, unfortunately, not a significant concern of theirs. Perhaps it is the decision to use the second atomic bomb that was more problematic and morally ambiguous in nature since the first bomb had already clearly displayed the prowess that the Americans had at their disposal.