Hammurabi's two primary achievements were extending the Babylonian Empire throughout Mesopotamia and drafting the Code of Hammurabi, one of the oldest and most comprehensive legal codes in the ancient world. When Hammurabi became king in 1792 B.C., Babylon was a small and relatively insignificant kingdom; by his death in 1750 he had consolidated almost all of Mesopotamia under his rule. Unfortunately for Hammurabi, his son, Samsu-iluna, was unable to maintain control of this vast empire.
Hammurabi's other great achievement was codifying the Babylonian laws into a unified code, usually referred to of the Code of Hammurabi. This Code included 282 legal principles (written in "if...,then..." format) designed to govern domestic, social, and commercial interactions. Hammurabi's view of justice was retributive (often called "eye for eye" justice).