LOC (lines of code) is a useful measure of amount of work done in software development. It works well when comparing orders of magnitude. Hello world: 1-10 LOC. Tetris: 100-200 LOC. Gmail: 1 Million LOC, Windows XP: 50 Million LOC.

What is the estimated number of lines in all current US federal laws?

I realize that this metrics isn't accurate. Which font size do we use? Do we include comments? How to count someone v. United States?

Since only order of magnitude matters we should use use 12px on letter, include comments and only include verdict if Supreme Court ruling changed the way a federal law is interpreted.

  • 3
    The "answer" will mean nothing. How do you equate LOC of software with the any sort of metric of the legal language of the federal code? LOC may be a metric for code, but I can write 500 lines of php and then rewrite the same code that does the same thing in 100 lines, so it's hardly an accurate metric itself of any sort of quality or function. With LOC of software and the federal code, you're not even compariing apples and oranges. Besides, Google would have found this for you: uscode.house.gov/download/download.shtml Sep 8, 2017 at 18:19
  • 1
    Including judicial rulings seems fraught with peril. They can be dozens of pages long, full of material that is often only tangentially related to the question being decided. For example, Roe v Wade includes a discussion of English law concerning abortion in the 19th and 20th centuries.
    – phoog
    Sep 8, 2017 at 20:07
  • 1
    I guess what I'm getting at is that the density of relevant information content in judicial opinions varies by more than an order of magnitude.
    – phoog
    Sep 8, 2017 at 21:17
  • 1
    @phoog This metrics has essentially the same set of problems in software development. Dead code [a 19th century law became irrelevant, but it remains a law nevertheless], duplicate code [nearly identical text in several relevant fields], different levels of scrutiny. All these factors make estimation less accurate, but don't prevent estimation per se.
    – Stepan
    Sep 8, 2017 at 21:29
  • 2
    @Stepan "Feels bad, man, but this isn't a reason to downvote/close a question.' This is a SE site for valid, objective, intelligent questions about the law. Your question is not. Read the responses and close votes. You're outvoted. Sep 8, 2017 at 22:36

2 Answers 2


What is the estimated number of lines in all current US federal laws?

I realize that this metrics isn't accurate. Which font size do we use? Do we include comments? How to count someone v. United States?

U.S. federal law consists of:

  • 52 Titles of the United States Code (some of which have more than one volume) and a smattering of uncodified statutes that probably would take up one or two additional books. On the order of 100 volumes.

  • About 2 volumes worth of federal court rules of general applicability.

  • About 200 sets of local court rules for particular federal courts. On the order of 20 volumes for the whole set.

  • About 2000 volumes of the Federal Reporter which sets forth published appellate court decisions.

  • About 2150 volumes of the Federal Supplement which sets forth selected federal trial court opinions.

  • On the order of 500 volumes of the Federal Rules Decisions which sets forth selected trial court opinions interpreting court rules.

  • 582 volumes of the United States Reporter which sets forth U.S. Supreme Court decisions.

  • A set of U.S. Treaties in Force on the order of 20-30 volumes.

  • The Code of Federal Regulations (50 titles, some of which have more than one volume). On the order of 200 volumes.

  • Several hundred treaties with U.S. Indian tribes, probably about 20 volumes.

  • About 500 volumes of territorial legislation still in force (e.g. statutes of Guam, Puerto Rico, U.S. Virgin Islands, District of Columbia, Indian reservations).

So, this would mean roughly 4500 volumes that have about 1000 pages of text each for a total of 4,500,000 pages, typically single spaced in 10 point (10/72nds of an inch) font on letter sized paper with half inch margins (i.e. 7.5 inches for text per page top to bottom) which works out to on the order of 50 lines per page.

So, roughly, 225 million lines of code equivalent for primary federal materials only.

There are some judgment calls about definitions here. For example, I did not include the full text of all works deposited with the library of Congress as part of the documentation of copyrights, or the full text of all patents and trademarks ever issued, each of which would dramatically increase the total, even though reference to those materials is necessary to determine if another work infringes a copyright or patent. Similarly, I omitted recorded real estate documents and publicly filed corporate documents even though those could each be referenced as evidence in a court case to determine someone's legal rights. And, I didn't include court orders in trial courts with no precedential effects which are binding between the parties even though some consent decrees in that set of documents have the force of law.

Of course, the problem is that U.S. federal law isn't an independent body of law by itself, by design. U.S. federal law routinely incorporates the law of the state in question by reference. For example, criminal liability in federal parks is determined in part by reference to state law.

A full set of state statutes and regulations in a typical U.S. state would require perhaps 50 volumes for a total of about 2500 volumes, and the entire corpus of published state level case law for all states combined is on the order of 10,000 volumes. So, excluding municipal ordinances, you are looking at another 12,500,000 pages at 50 lines a page, for about 600 million lines of code. Local government ordinances are litigated in state court so there is no separate body of case law for them.

But, there are about 100,000 local governments and there are probably about 2 volumes of law for each, so about 200,000,000 pages and about 1,000 million lines of code.

I'm sure I've made some minor omissions (e.g., case law from the courts of U.S. Indian Tribes), but the grand total for all U.S. law local, state and federal is on the order of 2 billion (i.e. 2,000,000,000) lines of code.

Also, keep in mind that this is only the primary materials and doesn't include treatises and textbooks and digests and law review articles interpreting the law which you need in practice to utilize this corpus of primary legal materials, and which can be referenced by courts in cases. On the other hand, secondary sources are profoundly less redundant than primary sources. You could have a pretty comprehensive collection of secondary sources with 2,000 volumes which would be about 2,000,000 pages and about 100 million lines of code which could be rolled into the omitted materials in my 2 billion lines estimate.

Of course, this is highly redundant. Case law spends lots of time reciting rulings from prior cases and the language of the relevant statutes and regulations, for example, and many municipal ordinances start out with an exact copy of another municipality's municipal ordinances before the municipality starts writing its own original legislation. Similarly, state traffic codes are often copied from one another. Also, not every reported case continues to be good law. But, there is no good way to separate the wheat from the chaff for a user of these legal authorities. You need them all.

  • Your answer explains how laws are organized, which is even more valuable. Thank you for the answer.
    – Stepan
    Sep 9, 2017 at 14:28

Assuming that http://uscode.house.gov/download/download.shtml Public Law 115-55 "All titles in the format selected compressed into a zip archive" covers most of the it we are dealing with 10M-100M lines of text.

Modern OS has similar volume. Would be curious to compare amount of dead and duplicate code in OS and in this set of laws.

  • Well, my estimate is correct within the order of magnitude. Not bad for a layman.
    – Stepan
    Sep 9, 2017 at 14:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .