Code, law and regulation: the difference almost nobody explains

Verified on: 2026-08-16

Three words that get mixed up constantly

"Law", "code" and "regulation" are used as if they were interchangeable, and they are not. Mixing them up isn't just a technicality — it changes which authority can modify the rule, how flexible it is, and what happens when one contradicts another. (This explanation follows the Mexican legal system.)

Law (ley)

In its formal sense, a law is the legal rule created by the Legislative branch (Congress) following the constitutional procedure for it. It regulates a specific subject.

Code (código)

A code is also a law in the formal sense — passed by the same Congress, through the same procedure — but with one added feature: it's a systematic, organized compilation of an entire branch of law, with unity of subject matter, structure and method. The Civil Code, the Criminal Code and the Commercial Code are the classic examples.

In other words: every code is a law, but not every law is organized as a code. The difference is in the method of organization, not in hierarchy — both sit at the same level within the legal system.

Regulation (reglamento)

Here the authority changes. A regulation isn't issued by Congress — it's issued by the Executive branch, to detail how an existing law is applied administratively. This power comes from Article 89, Section I of the Mexican Constitution.

That's why a regulation is subordinate to the law: it cannot contradict it, expand beyond what it allows, or replace it. Mexico's Supreme Court has explained this through two principles — legal reserve (some matters can only be regulated by a law, never a regulation) and hierarchical subordination (the regulation lives "below" the law and depends on it).

The other meaning of "code"

There's a second, non-legal meaning: code as the instructions a program follows — source code. Same word, a similar underlying idea: a written rule system that something (a society, a program) must follow consistently. It's not a legal equivalence — a legal code and a software codebase operate under completely different logic — but it's the reason increasingly more legal rules end up applied through software systems, which is exactly what this space is about.

This article explains general concepts of Mexican law for informational and educational purposes. It does not constitute legal advice for a specific case.

Ley & Código Newsletter

Legal changes and digital tools, explained clearly. No spam, unsubscribe anytime.

By subscribing you accept the privacy notice. We'll only use your email to send the newsletter.

Ley & Código content is informational and educational: it is not legal advice and by itself does not create a professional relationship. Representation exists only when a person with a verified license accepts the matter, with agreed scope and conditions.