How did the ten commandments compared to hammurabis code

I don't know of any scholar who denies that Hammurabi wrote a code of laws before Moses received the Ten Commandments and the accompanying law. So if the question is: Did Moses invent the idea of having a written code of laws, the answer is clearly "no".

But if the question is: Were the specific set of laws in the Ten Commandments et al not really written by God himself as the Bible claims (Deuteronomy 4:13), but my Moses, and did Moses copy them from Hammurabi?, then I say this:

People who make this argument point to similarities in the laws. Like, Hammurabi has laws against murder, stealing and kidnapping, and so does Moses! But almost anyone writing a set of laws for a nation would include laws against murder, stealing, and kidnapping. Cultures that surely never heard of Hammurabi, like the Chinese and the American Indians, also had laws against murder etc. It is an interesting philosophical and theological question why diverse cultures all over the world all agree that murder is wrong, but any theory that it is because they all copied from Hammurabi would be very difficult to defend.

While Hammurabi and Moses have some overlap like this, they also diverge on many points. The Code of Hammurabi devotes considerable space to the responsibilities of renters and tenants, things barely mentioned by Moses. Hammurabi has a long list of government-set prices for various products, something not found in Moses at all. Moses has many rules about public health and safety, a subject not particularly covered in Hammurabi. Moses says a lot about religious matters, like kosher foods and specific holidays and rituals, subjects not in Hammurabi.

Even in the areas that both law codes cover, there are major differences.

Here's a typical law from Hammurabi:

If anyone brings an accusation against a man, and the accused go to the river and leap into the river, if he sink in the river his accuser shall take possession of his house. But if the river prove that the accused is not guilty, and he escape unhurt, then he who had brought the accusation shall be put to death, while he who leaped into the river shall take possession of the house that had belonged to his accuser. (Code of Hammurabi, #2)

Compare this to a typical law from Moses:

You shall appoint judges and officers in all your gates, which the Lord your God gives you, according to your tribes, and they shall judge the people with just judgment. You shall not pervert justice; you shall not show partiality, nor take a bribe ... (Deuteronomy 16:18-19)

Hammurabi says to determine guilt by magic. Moses says to determine guilt by having judges who examine the evidence.

Perhaps the most striking similarity is that Hammurabi and Moses have similar wording about the idea of "an eye for an eye". But even here the laws are quite different. Here's Moses's version:

If a man causes disfigurement of his neighbor, as he has done, so shall it be done to him -- fracture for fracture, eye for eye, tooth for tooth. (Leviticus 24:19-20)

(Many today consider this law cruel and barbaric. Personally I think it's barbaric to say that someone can deliberately gouge out another's persons eyes and blind him, be caught and convicted, and then serve a couple of years in jail and be out on the streets, going on with his life, while his victim is still blind. I think he should at least stay in jail until his victim's eyes grow back. But my point here isn't to defend the fairness of Biblical laws, just to contrast Moses and Hammurabi.)

Here's Hammurabi's version:

If a man put out the eye of another man, his eye shall be put out. ... If he put out the eye of a freed man, or break the bone of a freed man, he shall pay one gold mina. If he put out the eye of a man's slave, or break the bone of a man's slave, he shall pay one-half of its value. (Hammurabi #196, 198, 199)

Under Hammurabi's law, assaulting an injuring a slave is a minor crime calling for a small fine. Assaulting and injuring a freed man, i.e. a former slave, is a bigger crime calling for a bigger fine. Assaulting someone of higher social status is a serious crime calling for serious punishment. Under Moses. there is no distinction under the law based on your social status. So while they have some vaguely similar wording, the whole point is exactly the opposite: Under Moses, if you deliberately injure someone else, you are to be punished by being injured in the same way, regardless of social status. In Hammurabi, the severity of punishment depends on the social status of the victim.

Indeed throughout the code of Hammurabi, there are different penalties for injuring a slave versus a freedman versus someone born free versus a nobleman. Moses requires complete impartiality:

You shall do no injustice in judgment. You shall not be partial to the poor, nor honor the person of the mighty. In righteousness you shall judge your neighbor. (Leviticus 19:15)

The only social distinction I see in Moses is that crimes by a master against his own slaves are treated differently. In general, if you do someone temporary injury so that he can't work, you have to compensate him for his lost time. But if a master injures his own slave, he doesn't have to compensate him. Presumably because the value of the lost work would hurt the master, not the slave. BTW if a master permanently injured a slave, like knocking out an eye or a tooth, he was required to let the slave go free in compensation. (Exodus 21:26-27) (And yes, the Old Testament law tolerates slavery. But that's a subject for another time.)

Hammurabi calls for "family justice":

If a prisoner die in prison from blows or maltreatment ... if he was a free-born man, the son of the jailor shall be put to death. (Hammurabi, #116)

And:

If a man strike a free-born woman so ... the woman die, his daughter shall be put to death. (Hammurabi, #209-210)

That is, if someone commits a crime, his children can be executed for it.

Moses says the opposite:

Fathers shall not be put to death for their children, nor shall children be put to death for their fathers; a person shall be put to death for his own sin. (Deuteronomy 24:16)

So yeah, there are some similarities between the two law codes. But there are huge differences. Even ignoring Biblical statements that the Old Testament law was given by God, if we assume that it was written by Moses or some other nameless author, there's still little evidence that it was copied from Hammurabi. The Code of Hammurabi has about as much similarity to the Old Testament law as it has to Obamacare. :-)

How is Hammurabi's Code and the Ten Commandments different?

Since Hammurabi's Code is so extensive, a general comparison between it and the Ten Commandments is best. Each set of edicts deals with the crimes or sins of mankind, including murder, adultery, and theft. Compared to that, however, the Code is a legalistic foundation used throughout history and in modern times.

How are Hammurabi's laws similar to the 10 Commandments?

The same goes for Hammurabi's code. Law 195 says, ”If a son strike his father, his hands shall be hewn off.” Hitting your parents is very disrespectful, so, Hammurabi's code is telling children to respect their parents. Both Ten Commandments and Hammurabi's Code also enforce rules about stealing.

What law is similar to Hammurabi's code?

Other written examples of ancient law, such as the Sumerian Code of Ur-Nammu and the Laws of Eshnunna, predate the Code of Hammurabi by several hundred years, and include many similarities.

Is Hammurabi's code older than the Ten Commandments?

The laws in the code are undoubtedly much older than Hammurabi's time. They express the decisions of the judges on the various cases coming before them in the course of centuries.