They certainly killed less people than the bombing that had already occurred - the destruction of Tokyo alone likely killed more people than either atomic bomb.
There's no real consensus in the alternative history conjecture space, and no way to resolve the theories floated, Gar Alperovitz (for one example) made the argument that
* that Japan was already defeated at the time the decision to use the bomb was made, and that US intelligence already knew this;
* that Japan had been suing for peace and was ready to surrender without an invasion;
* that the real reason the bomb was used was so to demonstrate its power to the Soviet Union, in an attempt to exert more influence on them in the postwar;
* and that Japanese Emperor’s surrender statement invoked the bomb only as a politically-acceptable “excuse” for his people, when actually he surrendered primarily because of the Soviet invasion of Manchuria.
( in https://www.amazon.com/gp/product/B004FGMR3S )