This site is only a doorway

Everything here is gathered from things other people actually researched, thought through, and built: books, papers, historical records, and the people behind them. If something here catches your interest, go look at the original sources listed at the bottom of the page. They carry more depth than a page like this ever can.

Why Can a Dirty QR Code Still Be Scanned? How Error Correction Trades Off Against Code Size

Category: Technology

Have you ever tried to scan a QR code that was slightly smudged or had a corner missing, only for your smartphone to read it perfectly? Ordinary text loses its meaning if even one letter is unreadable. But QR codes are designed differently. They include extra information from the very beginning, allowing them to recover lost data through calculation.

This system is called "error correction." However, there is a cost: adding more protection makes the code larger. Furthermore, common explanations about how much of a code can be hidden often cause confusion because they refer to data units rather than physical area. This article explores these concepts using official documentation and examples.[1]

1. How a QR Code Can Be Read Even When Part of It Is Dirty or Missing

Even if a fingerprint marks the corner of a QR code on a flyer, you can often still scan it. Unlike normal text, where missing characters change the meaning, QR codes are built to survive damage. They record extra data alongside the original information specifically to find and fix errors. If part of the code is missing, the remaining data allows a computer to calculate what was lost.[1]

How is this extra data created, and what do we pay for it? The following sections explain the mechanism step by step.

2. Who Created the QR Code in 1994, and Why

The QR code was developed in 1994 at Denso (now Denso Wave) by a team of two people led by Masahiro Hara.[5] At that time, standard barcodes could hold only about 20 alphanumeric characters. Workers were scanning them approximately 1,000 times per day, according to the development introduction page. It took about one and a half years from start to completion. QR codes can represent about 7,000 numeric characters and also kanji (Japanese characters).[5]

This technology was published as a standard. It became an AIM standard in 1997, a JIS standard in 1999, and an ISO/IEC 18004 standard in 2000. Within the scope of these standards, it has been declared that patent rights will not be enforced.[6]

Since so much information can fit into one code, having a backup plan for when it becomes unreadable is crucial. The next section looks at that backup.

3. How Extra Correction Data Lets Us Recover Missing Numbers

Imagine you need to remember three numbers: 3, 5, and 2. If you also write down their sum, "10," you can figure out any missing number. If the "5" is smudged out, you subtract 3 and 2 from 10 to get 5. The extra number allowed you to recover the lost value through calculation.

The actual system is more complex, so this sum is just an analogy. However, the core idea remains: store extra information so that gaps can be filled by calculation. On the official QR code website, there is an example where data consists of 100 units. To correct up to 50 errors using Reed-Solomon codes, you need twice as many correction data units—100 in total. The whole set is 200 units, and since 50 can be corrected, the error correction rate is 50 divided by 200, which equals 25%.[1]

In QR codes, these "units" are called codewords. Each codeword represents 8 bits of information.[3]

4. The Reed-Solomon Code: The Calculation Method Behind QR Error Correction

The calculation method used is called the Reed-Solomon code. It was developed by Reed and Solomon in 1960.[2] This system is used in CDs, DVDs, satellite communications, and QR codes.[2]

In a QR code, information from small black or white squares is grouped into sets of eight to form a "codeword." These groups are the units for error correction. A group of several pieces of information treated as one unit is called a "symbol." Because this code treats symbols as single units, it is said to be strong against "continuous damage," where adjacent areas are destroyed together.[2] The codewords in a QR code correspond to these symbols.[3]

To correct errors in t symbols, you need 2t correction symbols.[2] This matches the example in the previous section: correcting 50 errors required 100 correction units. Damage often happens in clumps, like when a finger rubs across a surface. However, the fact that this code is strong against continuous damage and the specific reason it was chosen for QR codes are separate questions.

5. The Four Error Correction Levels: Higher Protection Makes a Bigger QR Code

QR codes have four error correction levels: L, M, Q, and H. The approximate percentage of data that can be corrected is 7%, 15%, 25%, and 30%, respectively.[1] As the level increases, recovery power improves, but more data is added, making the code physically larger.[1] It is said that Level M is commonly used in general.[1]

The size of a QR code is determined by its "version," which ranges from 1 to 40. Version 1 is 21×21 modules (squares), and version 40 is 177×177 modules. Each time the version increases, one side grows by 4 modules.[7] The total number of modules ranges from 441 to 31,329, which is about a 71-fold increase.

Whether your data fits depends on three factors: the type and amount of data, the error correction level, and the version. For example, putting 100 digits of numeric data at Level M results in Version 3 (29×29 modules).[7]

There is a clear trade-off here. To make a code resistant to dirt, it becomes larger for the same content. If you want to print it small, you must reduce the margin for error correction.

6. Does "30% Correctable" Mean 30% of the Visible Area Can Be Hidden?

You may hear that "at Level H, you can hide up to 30% of the code and still scan it." Is this 30% referring to the visible surface area? According to official pages, the error correction rate is expressed as a ratio against all codewords. This is because damage does not necessarily affect only the correction codewords.[1] The count is based on the number of codewords, not physical area.[3]

In one individual's test, placing a logo with sides 40% of the QR code's width (covering about 21% of the area) worked at Level H. However, at Level L, a logo with sides 40% wide (covering about 23%) failed to scan. Even though the covered area was similar—about 20%—the results were opposite. The writer stated that at Level L, the version number was lower, and the logo overlapped with the position detection pattern, which caused the failure. They also wrote that the three corner position detection patterns and timing patterns are not subject to error correction; covering them can make the code unreadable.[4]

This is one person's verification result, and outcomes likely change depending on conditions. It is better not to read this as a law that "it will always happen this way."

7. Questions to Investigate If You Want to Create QR Codes

If you are in the position of creating QR codes, consider these questions:

  • Which level (L, M, Q, or H) is suitable for a small sticker on a train versus a large sign at a shop? Explain your reasoning.
  • To correct up to 50 errors in 100 data units, how many correction data units are needed? Use the relationship of 2t to calculate.
  • When you see an explanation saying "30% can be hidden," check what that 30% actually refers to.

Materials available in Japanese include Denso Wave's "QRcode.com" (pages on error correction, versions, and history)[1][7][6] and the development introduction page.[5] Stories about QR code development and position detection patterns are in separate notes.

Sources

  1. QRcode.com (Denso Wave), "About Error Correction" https://www.qrcode.com/about/error_correction.html (Supports that correction rate is a ratio of all codewords, provides the 100/50 example, and links levels to size.)
  2. Wikipedia (Japanese version), "Reed-Solomon code" https://ja.wikipedia.org/wiki/%E3%83%AA%E3%83%BC%E3%83%89%E3%83%BB%E3%82%BD%E3%83%AD%E3%83%A2%E3%83%B3%E7%AC%A6%E5%8F%B7 (Supports the 1960 development date, the requirement for 2t redundant symbols, and common applications.)
  3. QR WORLD, "What is the error correction function of a QR code?" https://qr.c-cloud.co.jp/articles/knowledge/error-correction (Clarifies that 1 codeword equals 8 bits and counts are based on codewords, not area.)
  4. Qiita, "The claim 'H can hide 30%' for logo-included QR codes is probably wrong" https://qiita.com/hashito/items/7d7bf6f84bddbfe5f0fb (Details an individual's test comparing Level H and L with logos, noting uncorrectable patterns like position detectors.)
  5. Denso Wave, "QR Code Development" https://www.denso-wave.com/ja/technology/vol1.html (Supports the 1994 development, the two-person team, the ~20 character limit of old barcodes, and the ~1.5 year timeline.)
  6. QRcode.com, "The Road to Standardization" https://www.qrcode.com/history/ (Supports the standardization years (AIM, JIS, ISO) and the declaration regarding patent rights.)
  7. QRcode.com, "Version" https://www.qrcode.com/about/version.html (Supports version numbers 1-40, module counts, and capacity examples like 100 digits at Level M.)