Equality before the law, also known as equality under the law, equality in the eyes of the law, legal equality, or legal egalitarianism, is the principle that each independent being must be treated equally by the law (principle of isonomy) and that all are subject to the same laws of justice (due process). Therefore, the law must guarantee that no individual nor group of individuals be privileged or discriminated against by the government. Equality before the law is one of the basic principles of liberalism. This principle arises from various important and complex questions concerning equality, fairness and justice. Thus, the principle of equality before the law is incompatible and ceases to exist with legal systems such as slavery, servitude.
Article 7 of the Universal Declaration of Human Rights (UDHR) states: "All are equal before the law and are entitled without any discrimination to equal protection of the law". Thus, everyone must be treated equally under the law regardless of race, gender, color, ethnicity, religion, disability, or other characteristics, without privilege, discrimination or bias. The general guarantee of equality is provided by most of the world's national constitutions, but specific implementations of this guarantee vary. For example, while many constitutions guarantee equality regardless of race, only a few mention the right to equality regardless of nationality.
A legalist Guan Zhong (720–645 BC) declared that all persons under the jurisdiction of the ruler are equal before the law.
The 431 BCE funeral oration of Pericles, recorded in Thucydides's History of the Peloponnesian War, includes a passage praising the equality among the free male citizens of the Athenian democracy:
If we look to the laws, they afford equal justice to all in their private differences; if to social standing, advancement in public life falls to reputation for capacity, class considerations not being allowed to interfere with merit; nor again does poverty bar the way.
The state of Nebraska adopted the motto 'Equality Before the Law' in 1867 and it appears on both the state flag and the state seal. 
Liberalism calls for equality before the law for all persons. Classical liberalism as embraced by libertarians and modern American conservatives opposes pursuing group rights at the expense of individual rights.
In his Second Treatise of Government (1689), John Locke wrote: "A state also of equality, wherein all the power and jurisdiction is reciprocal, no one having more than another; there being nothing more evident, than that creatures of the same species and rank, promiscuously born to all the same advantages of nature, and the use of the same faculties, should also be equal one amongst another without subordination or subjection, unless the lord and master of them all should, by any manifest declaration of his will, set one above another, and confer on him, by an evident and clear appointment, an undoubted right to dominion and sovereignty."
In 1774, Alexander Hamilton wrote: "All men have one common original, they participate in one common nature, and consequently have one common right. No reason can be assigned why one man should exercise any power over his fellow creatures more than another, unless they voluntarily vest him with it".
In Social Statics, Herbert Spencer defined it as a natural law "that every man may claim the fullest liberty to exercise his faculties compatible with the possession of like liberty to every other man". Stated another way by Spencer, "each has freedom to do all that he wills provided that he infringes not the equal freedom of any other".
Equality before the law is a tenet of some branches of feminism. In the 19th century, gender equality before the law was a radical goal, but some later feminist views hold that formal legal equality is not enough to create actual and social equality between women and men. An ideal of formal equality may penalize women for failing to conform to a male norm while an ideal of different treatment may reinforce sexist stereotypes.
In 1988, prior to serving as a Justice of the Supreme Court, Ruth Bader Ginsburg wrote: "Generalizations about the way women or men are – my life experience bears out – cannot guide me reliably in making decisions about particular individuals. At least in the law, I have found no natural superiority or deficiency in either sex. In class or in grading papers from 1963 to 1980, and now in reading briefs and listening to arguments in court for over seventeen years, I have detected no reliable indicator or distinctly male or surely female thinking – even penmanship". In an American Civil Liberties Union's Women's Rights Project in the 1970s, Ginsburg challenged in Frontiero v. Richardson the laws that gave health service benefits to wives of servicemen, but not to husbands of servicewomen. There are over 150 national constitutions that currently mention equality regardless of gender.
Article 200 of the Criminal Code of Japan, the penalty regarding parricide, was declared unconstitutional for violating the equality under the law by the Supreme Court of Japan in 1973. This was a result of the trial of the Tochigi patricide case.