Code of Hammurabi

Server Costs Fundraiser 2024

Help our mission to provide free history education to the world! Please donate and contribute to covering our server costs in 2024. With your support, millions of people learn about history entirely for free every month.
$2899 / $18000


Joshua J. Mark
published on 24 June 2021
Available in other languages: French, Portuguese, Spanish
Code of Hammurabi (by Larry Koester, CC BY)
Code of Hammurabi
Larry Koester (CC BY)

The Code of Hammurabi was a set of 282 laws inscribed in stone by the Babylonian king Hammurabi (r. 1795-1750 BCE) who conquered and then ruled ancient Mesopotamia. Although his law code was not the first, it was the most clearly defined and influenced the laws of other cultures.

The earliest extant set of laws from ancient Mesopotamia is the Code of Ur-Nammu dating from c. 2100-2050 BCE and set down in the city of Ur either by King Ur-Nammu (r. 2047-2030 BCE) or his son Shulgi of Ur (r. 2029-1982 BCE). These laws were written by a king who ruled over a homogenous population and were operating from a standard recognition of what was expected of the citizens. By the time of Hammurabi’s reign, the population was more diverse, and his law code reflects this in its precision to make sure everyone understood what was expected of them.

Remove Ads

The laws address business contracts and proper prices for goods as well as family and criminal law. Every crime inscribed on the stele is followed by the punishment to be inflicted. No one could claim they were ignorant of the law as the over seven-foot-tall stele was erected publicly. At the top, it was engraved with an image of Shamash, the god of justice, handing the laws to Hammurabi and the following text makes clear that these are laws of the gods, not arbitrary rules created by mortals.

Hammurabi’s empire fell apart after his death and Babylon was sacked repeatedly over the years. Around 1150 BCE, Shutruk Nakhunte, King of Elam, sacked the city of Sippar, near Babylon, and is thought to have taken the Code of Hammurabi along with the statue of the god Marduk back to Elam as spoils of war. It was discovered in 1901 in the ruins of the Elamite city of Susa and today is on display at the Louvre Museum, Paris, France.

Remove Ads

Code of Ur-Nammu

The earliest Mesopotamian law code was the Code of Urukagina (c. 24th century BCE) which exists today only in fragments. The Code of Ur-Nammu, although also fragmentary in the present day, is still cohesive enough to give a clear understanding of what the laws addressed. The laws were written in cuneiform on clay tablets and follow a model possibly first established by the Code of Urukagina which would also influence the later Laws of Eshnunna (c. 1930 BCE), the code of the king Lipit-Ishtar (r. c. 1870 - c. 1860 BCE), and Hammurabi’s.

Ur-Nammu claimed the laws came from the gods and Ur-Nammu was only the administrator, passing down to the people the will of their gods.

Mesopotamia had been governed by Sargon of Akkad (r. 2334-2279 BCE) who established his Akkadian Empire beginning in 2334 BCE. The empire fell to the invading Gutians c. 2083 BCE who, according to the records and literature of the time, refused to recognize the gods of the region and the customs. The king of Uruk, Utu-Hegal, led a successful rebellion against the Gutians and defeated them but, soon after, drowned. He was succeeded in the ongoing war by his son-in-law Ur-Nammu who, with his son, drove the Gutians from the land.

Remove Ads

Although the people of Mesopotamia had repeatedly rebelled against Sargon and his successors, after the fall of the Akkadian Empire and the resulting chaos of Gutian rule, the Akkadian kings were revered as heroes of a golden age. The literary genre known as Mesopotamian Naru Literature regularly featured Sargon or his grandson Naram-Sin (r. 2261-2224 BCE) as central characters who either embody the principles of kingship or serve as cautionary figures in how one should respect and heed the will of the gods in order to prosper.

Law Code of King Ur-Nammu
Law Code of King Ur-Nammu
Osama Shukir Muhammed Amin (Copyright)

Ur-Nammu understood the importance of identifying himself with these heroes of the past who, in his time, were no longer remembered as oppressors but as great father figures who had cared for the land and its people. He therefore presented himself as just such a father figure and instituted a patrimonial state, encouraging his subjects to think of themselves as his children and all as members of a family. In order for this model to work, however, the people had to agree to it. Scholar Paul Kriwaczek comments:

For a patrimonial state to be stable over time, it is best ruled with consent, at least with consent from the largest minority, if not from the majority. Instinctive obedience must be the norm, otherwise too much effort needs to be put into suppressing disaffection for the regime’s wider aims to be achievable. (149)

The Akkadian kings (in reality, not in the fictionalized form Ur-Nammu’s people remembered them) had suffered numerous rebellions precisely because they did not have the consent of the people. To prevent these same problems, Ur-Nammu claimed the laws came from the gods and Ur-Nammu was only the administrator, the middleman, passing down to the people the will of their gods and enforcing their precepts. The laws all follow the pattern of the conditional sentence, if-this-then-that, as in this brief sampling:

Remove Ads

If a man proceeded by force and deflowered the virgin slave-woman of another man, that man must pay five shekels of silver.

If a man appeared as a witness, and was shown to be a perjurer, he must pay fifteen shekels of silver.

If a man knocked out the eye of another man, he shall weigh out half a mina of silver.

If a man knocked out a tooth of another man, he shall pay two shekels of silver. (Kriwaczek, 150)

The fine for infractions served as a deterrent, no harsher penalty required, because Ur-Nammu had the consent of the governed who all understood – at least in theory – what constituted acceptable behavior. Under Ur-Nammu and his successor-son Shulgi, this model worked well and allowed for the great cultural revival known as the Sumerian Renaissance under their reigns. The Laws of Eshnunna seem to have used Ur-Nammu’s as a model but these applied only to the city of Eshnunna and did not have as great an influence as the others.

Code of Lipit-Ishtar

It is unclear whether Ur-Nammu wrote and issued his law code or if it was published by Shulgi after his father’s death but the stability it provided continued through the Third Dynasty of Ur until the reign of Ibbi-Sin (c. 1963-1940 BCE) after which it was succeeded by the Dynasty of Isin, founded by Ishbi-Erra c. 1953/1940. The kingdom had grown progressively weaker even before Ibbi-Sin but during his reign was too weak to fend off invasions by Amorites and Elamites who finally brought down the Third Dynasty of Ur.

Remove Ads
By the time of Lipit-Ishtar, it could no longer be assumed that everyone was operating with the same understanding of what was proper behavior.

Ishbi-Erra had been a clerk under Ibbi-Sin and criticized the king for weakness before the invasions. He defeated both the Amorites and Elamites and restored order but the population the Dynasty of Isin ruled over was not the homogeneous patriarchal state of Ur-Nammu. Although the kings of Isin established and maintained order, by the time of the 5th king, Lipit-Ishtar, a new law code was necessary.

Unlike the Code of Ur-Nammu, the Code of Lipit-Ishtar had to be more precise to address the needs of a more complex society. Monetary fines were still in place as deterrents, but more detailed laws were required for family law and commercial contracts. It could no longer be assumed that everyone under the law was operating with the same understanding of what was proper behavior. Lipit-Ishtar’s code is also fragmentary but among the laws were:

If the master of an estate or its mistress has defaulted on the tax of said estate, and a stranger has borne it for three years, the owner may not be evicted but, afterwards, the man who bore the tax of the estate will possess said estate and the former owner cannot contest the claim.

If a man’s wife has not borne him children, but a harlot from the public square has borne him children, he shall provide grain, oil, and clothing for the harlot. The children which the harlot has borne him shall be his heirs and as long as his wife lives the harlot shall not live with the wife.

Love History?

Sign up for our free weekly email newsletter!

If a man cut down a tree in the garden of another man, he shall pay one-half mina of silver. (Duhaime, 1)

It is unclear what motivated Lipit-Ishtar to draft his law code, but he was honored during the reigns of his successors as a great king who defeated the Amorites and maintained order. Hymns were written praising him and his code provided the necessary stability up through the reign of the last king of the dynasty, Damiq-ilishu who was overthrown by Sin-Muballit (r. 1812-1793 BCE), fifth Amorite king of Babylon, and father of Hammurabi.

Code of Hammurabi

Sin-Muballit could not compete commercially with the lucrative trade center of Larsa which was aligned with the Dynasty of Isin, so he attacked it and was defeated by its king Rim-Sin I. The details of the peace are lost but one stipulation was that Sin-Muballit had to abdicate in favor of his son. Hammurabi began his reign quietly by continuing his father’s domestic policies and building programs in and around Babylon, raising temples, and giving Rim-Sin I and the other monarchs of the region no reason to suspect that he was also enlarging and equipping his army and planning the campaigns that would enable him to conquer Mesopotamia.

Code of Hammurabi - Detail
Code of Hammurabi - Detail
ctj71081 (CC BY-SA)

He may have instituted his law code c. 1772 BCE in order to ensure the kind of stability he required at home to successfully launch these campaigns though the date could be later. As Kriwaczek observed above, a king needed the consent of the governed for a stable social base if he had any hope of expanding his power and enlarging his territory. The Code of Hammurabi served this purpose by letting the populace know precisely how they should behave to live in peace under the law.

Whereas the earlier law codes set fines and other fairly minor penalties for infractions, Hammurabi’s punishments were far more severe:

If a man put out the eye of another man, his eye shall be put out.

If he break another man's bone, his bone shall be broken.

If a man knock out the teeth of his equal, his teeth shall be knocked out.

If a builder build a house for someone, and does not construct it properly,

And the house which he built fall in and kill its owner, then that builder shall be put to death.

If it kill the son of the owner of the house, the son of that builder shall be put to death. (Pritchard, 161)

Hammurabi’s Code exemplifies the law of retributive justice known as Lex Talionis defined by the concept of “an eye for an eye and a tooth for a tooth”. This was necessary because the population was now even more diverse than it had been under Lipit-Ishtar. Kriwaczek comments:

Hammurabi's laws reflect the shock of an unprecedented social environment: the multi-ethnic, multi-tribal Babylonian world. In earlier Sumerian-Akkadian times, all communities had felt themselves to be joint members of the same family, all equally servants under the eyes of the gods. In such circumstances disputes could be settled by recourse to a collectively accepted value system, where blood was thicker than water, and fair restitution more desirable than revenge. Now, however, when urban citizens commonly rubbed shoulders with nomads following a completely different way of life, when speakers of several west Semitic Amurru languages, as well as others, were thrown together with uncomprehending Akkadians, confrontation must all too easily have spilled over into conflict. Vendettas and blood feuds must often have threatened the cohesion of the empire. (180)

To prevent the possibility of such feuds contributing to social instability, Hammurabi made sure his laws were understood to be absolute. In the same way that Ur-Nammu claimed he had received his laws from the gods, so did Hammurabi but, in order for this to be perfectly clear, he had an image of the god of justice, Shamash, engraved at the top of the stele handing the laws down to Hammurabi. The laws which then follow down from that image in rows of cuneiform refer back to their divine origin as well as the greatness of Hammurabi as bani matim (“builder of the land”) who raised majestic temples to the gods, built canals, and irrigated the lands, and who was administering these laws for the good of all the people.

Hammurabi and Shamash
Hammurabi and Shamash
Mbzt (CC BY-SA)

Conquest & Consolidation

Hammurabi had shown himself a good and just king to his people and, having won the consent of the governed through his policies and laws, he was ready to expand his reach. When the Elamites invaded southern Mesopotamia, Hammurabi allied himself with Larsa and defeated them. He then quickly broke the alliance and took the cities of Uruk and Isin, which were under Larsa’s control, and drew on those resources to take others. Hammurabi repeatedly made alliances, kept them as long as they served his purpose, and broke them when he found they were no longer useful.

Once he had conquered southern Mesopotamia, he marched north. In the most startling display of his ability to turn on former allies, he attacked the Amorite kingdom of Mari whose monarch, Zimri-Lim (r. 1775-1761 BCE), had supported him from the beginning of his expansion. Throughout his campaigns, Hammurabi would take a city – often by either damming up the water until the defenders surrendered or damming and then releasing the water suddenly to flood the city and create confusion just prior to attacking – and then afterwards rebuild and refurbish it. In the case of Mari, however, he completely destroyed the city and left it in ruins while he continued his campaigns throughout the region and consolidated his control over the whole of Mesopotamia by 1755 BCE.

Babylon at the time of Hammurabi
Babylon at the time of Hammurabi
MapMaster (CC BY-SA)


Hammurabi’s code was instituted throughout the land, unifying the people under law instead of only by conquest. Unlike the Akkadian Empire, which had found it necessary to position hand-picked officials to administrate their conquered cities, Hammurabi controlled his empire through law. In the prologue to his code, he not only makes clear that these are divine laws but that he had only the people’s best interests at heart in administering them:

When the lofty Anu, King of the Annunaki and Bel, Lord of Heaven and Earth, he who determines the destiny of the land, committed the rule of all mankind to Marduk, when they pronounced the lofty name of Babylon, when they made it famous among the quarters of the world and in its midst established an everlasting kingdom whose foundations were firm as heaven and earth – at that time Anu and Bel called me, Hammurabi, the exalted prince, the worshipper of the gods, to cause justice to prevail in the land, to destroy the wicked and the evil, to prevent the strong from oppressing the weak, to enlighten the land and to further the welfare of the people. Hammurabi, the governor named by Bel, am I, who brought about plenty and abundance. (Durant, 219)

The concept of the law as an institution that protects the weak from the strong, as a force before which all people were equal, encouraged respect and admiration not only for the laws but also the lawgiver. Even though Hammurabi had taken the cities through conquest, during the last five years of his reign there is no evidence of revolt or dissent. The people recognized the laws of Hammurabi as working in their own interest and so upheld them, encouraging further stability and allowing for cultural advances.

Unfortunately, the empire of laws Hammurabi had created did not survive long after his death. His son and successor, Samsu-Iluna, who had co-ruled with him after 1755 BCE, was not up to the task of becoming a second Hammurabi. The city-states that had been content under Babylonian rule while the great king lived, revolted after his death, and while they may have kept his laws in their individual communities, they seem to have seen no need for the kind of unity Hammurabi had created.

This lack of unity made the city-states easy prey for invaders. The Hittites invaded in 1595 BCE and the Kassites shortly after and then the Elamites c. 1150 BCE under their king Shutruk Nakhunte. At this time, it is thought, the stele of the Code of Hammurabi was taken back to Elam where it would be found in 1901 CE broken in pieces. Its influence is notable, however, in the creation of later law codes such as the Middle Assyrian Laws, the Neo-Babylonian Laws, and the Mosaic Law of the Bible, all of which follow the same model as Hammurabi’s code in providing people with an objective, universal directive on how to treat others and how one should expect to be treated in a civilized society.

Did you like this definition?
Editorial Review This article has been reviewed by our editorial team before publication to ensure accuracy, reliability and adherence to academic standards in accordance with our editorial policy.
Remove Ads
Subscribe to this author

About the Author

Joshua J. Mark
Joshua J. Mark is World History Encyclopedia's co-founder and Content Director. He was previously a professor at Marist College (NY) where he taught history, philosophy, literature, and writing. He has traveled extensively and lived in Greece and Germany.


French Portuguese Spanish

We want people all over the world to learn about history. Help us and translate this definition into another language!

Free for the World, Supported by You

World History Encyclopedia is a non-profit organization. For only $5 per month you can become a member and support our mission to engage people with cultural heritage and to improve history education worldwide.

Become a Member  

Recommended Books

World History Encyclopedia is an Amazon Associate and earns a commission on qualifying book purchases.

Cite This Work

APA Style

Mark, J. J. (2021, June 24). Code of Hammurabi. World History Encyclopedia. Retrieved from

Chicago Style

Mark, Joshua J.. "Code of Hammurabi." World History Encyclopedia. Last modified June 24, 2021.

MLA Style

Mark, Joshua J.. "Code of Hammurabi." World History Encyclopedia. World History Encyclopedia, 24 Jun 2021. Web. 19 Jul 2024.