Qraft

How QR Codes Work - How Black and White Squares Carry Information

QR Codes Are "Two-Dimensional Barcodes"

Barcodes on supermarket products encode information using only horizontal line widths. QR codes arrange black and white cells (modules) in both vertical and horizontal directions, storing far more information. This is why they're called "two-dimensional codes."

Black modules represent "1" and white modules represent "0." This sequence of 0s and 1s becomes data. Since all computer data can be expressed in 0s and 1s, QR codes can store URLs, text, phone numbers, and various other information.

Three Large Squares Serve as Landmarks

The large squares at three corners of a QR code are called "finder patterns" - the first landmarks scanners look for. By finding these three squares, scanners instantly determine the QR code's position, size, and tilt.

Having squares at only three corners allows the remaining corner (bottom-right) to be inferred, enabling correct reading regardless of orientation. This is why QR codes can be scanned even at an angle.

"Error Correction" Reads Even Damaged Codes

QR codes contain "error correction codes" - repair data alongside the actual data. This enables mathematical restoration of lost data even when parts of the QR code are dirty or damaged.

Error correction strength has four levels (L, M, Q, H). At the strongest H level, the code remains readable even with about 30% damage. This is also why QR codes with logos overlaid in the center still scan correctly.

From Scan to Display

When scanning a QR code with a smartphone, these processes occur internally:

  1. The camera detects finder patterns in the image, identifying the QR code's position and orientation
  2. Each module (black/white cell) is read and converted to a data sequence of 0s and 1s
  3. Error correction codes repair scanning errors and damage-caused gaps
  4. The repaired data sequence is decoded into a string (URL or text)
  5. Based on the decoded result, actions like opening a browser or saving a contact are executed

This entire process completes in a fraction of a second, making it feel like the page opens the instant you scan.