What Was the Code of Hammurabi and Why Was It Written?

Composed in the 18th Century BCE, the Code of Hammurabi is one of the earliest comprehensive legal codes, far exceeding the scope of other codes discovered from the same period.

May 18, 2023By Nick Scott, Bachelor of Law (in-progress)

code of hammurabi


Carved on a 7-foot tall basalt monument, the Code of Hammurabi contains 282 laws developed in the First Babylonian Empire. The top of the stele contains a relief depicting King Hammurabi receiving the laws from the ancient Mesopotamian god Shamash, invoking the same themes seen in many extant Mesopotamian legal artifacts. The laws have been noted for their wide-ranging scope covering commercial, property, family, and criminal law areas.


The Code of Hammurabi is unique in several key areas, including the code’s scope and volume of laws. There is also a clear focus on the punishment of perpetrators rather than compensation for victims, which in some ways, is a departure from earlier Mesopotamian legal texts. The code is perhaps most well-known for the lex talionis principle, also known as ‘an eye for an eye’, which has been seen in many legal codes that followed. It is also noteworthy for its treatment of the presumption of innocence, establishing that those accused of crimes were innocent until proven guilty. Historians are still working to understand the purpose of the code, with many Assyriologists now believing the text was a work of legal theory or jurisprudence rather than legislation as was initially thought.


Read below for more information on this ancient Babylonian legal code and the king who created it.


Who Created the Code of Hammurabi?

relief hammurabi capitol
Relief of Hammurabi in the US Congress, by Thomas Hudson Jones, 1950, via the Architect of the Capitol


Hammurabi’s reign as the sixth king of Babylon’s Amorite Dynasty began in the early 18th Century BCE. His four-decade reign saw Babylon’s influence grow from a small city-state in the shadow of powerful Elam to the epicenter of an empire controlling the majority of Mesopotamia. Hammurabi is now famous for his legal code. However, his rule was characterized by his city’s rapid rise, driven by a combination of diplomacy and military campaigns, the latter eventually spanning the final 16 years of his life.

Get the latest articles delivered to your inbox

Sign up to our Free Weekly Newsletter


During the first years of his reign, Hammurabi built on the work of his father, Sin-Muballit, who had abdicated due to ill health. This included developing the city’s administration and beginning work on building a fortifying wall around the ancient city. Hammurabi’s early conquests saw the king deftly navigate the complex political landscape of Mesopotamia. Building an alliance with the Amorite city-state Larsa, Hammurabi led Babylon to defeat Elam after they invaded Mesopotamia from the East.


Map showing Babylonian Empires, including Hammurabi’s (yellow), via National Geographic


Having defeated Elam in 1764 BCE, Hammurabi broke the alliance with Larsa, forging new alliances to take two cities previously under the thrall of Larsa. A central power in Mesopotamia throughout the early 18th Century BCE, Larsa would be defeated by Hammurabi in 1763 BCE. This placed Babylon as the pre-eminent power in the region. The process of building and breaking alliances would characterize Babylon’s military expansion under Hammurabi.


Although the empire’s reach would rapidly erode under Samsu-iluna, Hammurabi’s son, the city remained under Babylonian control along with many of the bureaucratic and political reforms enacted throughout Hammurabi’s 40-year reign. Part of this legacy was the code composed towards the end of Hammurabi’s reign. While some historians have interpreted this as a propaganda tool created by an aging king seeking to define his legacy, the code provides a crucial source for understanding legal issues in Babylon and the societies under its influence.


How Was the Hammurabi Code (Re)Discovered?

susa archaeological site
Excavation Site in Susa, Iran, via UNESCO World Heritage Convention


The Louvre stele of the Hammurabi code was discovered during excavations at the ancient Elamite city of Susa in modern-day Iran. The discovery was made between 1901 and 1902 by an archaeological team under the direction of Jacques de Morgan. The stele was found in three pieces and later reconstructed. Although this is the most complete copy available, there are still over eighty lines missing towards the monument’s bottom.


One theory of how the stele arrived in Susa links to the erasure of these lines. The first report on the statue was published by French Assyrioligist Jean-Vincent Scheil, who suggested these lines were erased by Elamite king Šutruk-Nakhunte who ruled the region in the 12th Century BCE after bringing the statue to Susa. The motivation behind the erasure would be adding scripture to celebrate Šutruk-Nakhunte’s achievements.


discovery code hammurabi
Discovery of the Louvre stele, via The Louvre


While theories vary on the exact provenance of the stele, it is generally agreed that it was taken to Elam in the 12th Century. Historian Martha Roth has discussed the difficulties in ascertaining the provenance of the stele, stating that it may have been taken by Shutruk-Nahhunte or his son Kutir-Nahhunte in the 12th Century from one of the locations where stelae were erected. Such locations included Babylon and Sippar, a city under Babylon’s control.


The French Archaeological Mission found the stele in a workroom, indicating plans to add additional scripture by the Elamites. Roth noted that this would have ignored the original inscription threatening that any king who modified the stele would be cursed. The monument’s discovery in this ancient Elamite city reflects an awareness of the code throughout the ancient Near East, even hundreds of years after Hammurabi’s death.


What Is the Code of Hammurabi?

stele hammurabi code
Stele of the Code of Hammurabi, c. 1755-1750 BCE via The Louvre


A full translation of the text on the stele shows a legal code spanning a broad range of areas of law relevant to life in 18th Century Babylon. The 281 rules on the stela take the form of distinct, conditional statements. This means that the text takes the form of ‘if… then…’ statements presenting specific situations and stipulating a legal response. With this structure, many of the laws refer to highly specific instances, with one example reading, “If anyone hires an ox, and a lion kills it in the field, the loss is upon its owner.”


The Presumption of Innocence


One of the most significant components of the Code of Hammurabi is the introduction of the presumption of innocence. This is one of the central concepts in the text and presents one of the earliest examples of the idea that citizens of a state are innocent until proven guilty. The code also establishes that cases can be brought before a judge with evidence and witnesses to establish innocence or guilty.


Reflective of Social Class Structures

hammurabi shamash code
Detail from the Louvre Stele of the Code of Hammurabi, via Wikimedia Commons


The laws reflect how oppressive social class structures defined life in Babylon. One provision reads, “if a free-born man strikes the body of another free-born man or equal rank, he shall pay one gold mina.” This contrasts with the previous line, which states, “if anyone strikes the body of a man higher in rank than he, he shall receive sixty blows with an ox-whip in public.” This indicates an emphasis on appeasing the wealthy upper class reflecting a focus on maintaining the established social order.


An Eye for an Eye


Another defining feature of the text is in the philosophy of lex talionis, or ‘an eye for an eye’. In translating the code, modern scholars quickly identified this philosophy throughout the code. In the context of the time period the law was created, this introduced a limiting factor on the punishment for crimes, establishing the idea of proportionality in crime and punishment. This concept is seen in Roman law in the maxim’ culpae poenae par esto’, which translates roughly to ‘let the punishment fit the crime’.


Minimum Wage

inscriptions hamurabe code stele
Inscriptions on the Stele of the Code of Hammurabi, c. 1755-1750 BCE, via The Louvre


Toward the end of the text, there is a number of provisions outlining the minimum wage that should be provided for a number of different jobs, something that many might find surprising in a text written more than 2500 years ago. The roles this related to included artisans, labourers and sailors. The text also includes a building code outlining liability if a building collapses. Similar provisions are included for injuries sustained during medical operations, although the punishments are less severe for physicians than builders.


What Is the Purpose of the Code of Hammurabi?

tablets library ashurbanipal
Tablets from the Library of Ashurbanipal, including a tablet listing Hammurabi’s Judgments, via The British Museum


There is a range of theories on the purpose and application of the Code of Hammurabi in 18th Century Babylon. While some historians have interpreted the text as legislation or statutes, many Assyriologists view the text as a work of legal theory with little application in courts. An alternative theory is that the code constituted a law report containing information on relevant cases throughout Mesopotamia. This is consistent with the structure and content of the text, with many entries relating to very specific circumstances.


Some of the arguments in favor of the text’s purpose as legal theory or jurisprudence relate to key omissions on many central areas of law. There is also no reference to the code in legal cases throughout Mesopotamia, with many judgments contradicting the code. Scholars have identified similarities between the list format utilized in the code and other works of Mesopotamian scholarship. Viewing the code through this lens shows that many entries mirror previous entries changing one variable to alter the outcome. The theory that the text was a work of jurisprudence links to the fact that Mesopotamian scribes copied the text as part of their training.


The Influence of the Code of Hammurabi

limestone votive hamurabi
Limestone votive monument depicting Hammurabi, 1792-1750 BCE, via British Museum


Copying the Code of Hammurabi played a central role in scribal training throughout Mesopotamia. This indicates the possible influence of the code in lawmaking throughout the region. However, scribes copied other legal texts that were also influential. This suggests that Mesopotamian lawmakers were influenced by a wider legal tradition of which Hammurabi’s Code formed just one part. Still, Hammurabi’s fame in the centuries after his reign may have contributed to his legal code’s influence within Mesopotamia.


There has been significant debate over the text’s influence on later legal systems in the regions surrounding Mesopotamia. Connections have been drawn between the lex talionis principle in Hammurabi’s Code and the Covenant Code. The code was studied and copied by scribes throughout Mesopotamia, and there is evidence that it was known in the surrounding regions. However, many historians believe that the texts share a common cultural influence, rather than the Covenant Code being directly influenced by Hammurabi’s.


Another example where the code may have been influential is in provisions resembling an early version of insurance. One provision states that if a sailor damages a ship but saves it from total loss, they will only be required to pay half the vessel’s value to the ship owner. This is an early precursor of the general average principle in maritime law in later societies. The general average principle states that losses incurred will be shared among stakeholders in shipping where measures were taken to successfully avoid the total loss of a ship.


A similar rule formed part of the Rhodes Maritime Code, appearing around the 9th Century BCE and is still present in many countries’ maritime laws. While historians have debated the purpose and influence of Hammurabi’s Code since it was rediscovered at the beginning of the 20th Century, the scope of the text means that it is one of the most detailed extant legal documents from the Bronze Age. Over 3500 years since it was composed, aspects of this text, such as the presumption of innocence and a precursor to the general average principle, can offer parallels to provisions in modern legal systems drawing a fascinating connection to the ancient world.

Author Image

By Nick ScottBachelor of Law (in-progress)Nick Scott is a law student with a specific interest in legal history and comparative law. Alongside studying for a law degree, Nick is a contributing writer and has written for The Times and Politics.co.uk.