- Home
- Technology
- QR codes and barcodes
QR codes and barcodes
How a square of black and white dots can hold a web address, and still work when it is scuffed.
The short version
A barcode and a QR code are patterns of black and white that a scanner turns into numbers or text. A barcode is a row of stripes; a QR code is a square grid, so it holds far more, plus extra data that lets it survive damage.
I always thought a barcode contained the product's price.
It holds only a number.
The shop's computer looks the price up.
Barcodes
A shop barcode is a row of thick and thin stripes. A scanner shines light across it and measures how much is reflected: dark stripes absorb, white gaps reflect. The widths of the stripes and gaps spell out digits.
The last digit is a check digit, worked out from the others. If the scanner reads a digit wrongly, the check fails and the till beeps again. The number identifies the product. The price is stored in the shop's system and can change without changing the code.
QR codes
A QR code, short for quick response, uses a two-dimensional grid. The three large squares in the corners tell a camera where the code is, which way up it is, and how big. The rest of the grid is the data, in small squares, each black or white, which the phone reads as ones and zeros.
QR codes can hold a few thousand characters, but usually they hold a web address, which the phone opens.
Up to 30%
How much of a QR code can be damaged or covered and still be read, at the highest error-correction level. Extra data is added so that missing pieces can be worked out from the rest.
Scanning a QR code is always safe.
A QR code can encode text or other data, often a web link. If it points to a harmful site, opening it can be a problem. Check the address your phone shows before you tap it, especially on a code stuck over another.
The square pattern makes QR codes useful when a camera needs to read information quickly from a sign, package or screen. Modern phones can usually scan one with their built-in camera.
A short history
- 1974 The first barcode scanned in a shop in the United States, on a packet of chewing gum.
- 1994 Denso Wave, a Japanese company, invents the QR code to track car parts.
- 2017 The iPhone camera app begins to read QR codes without a separate app.
Inside the grid
The smallest QR code is 21 squares across and the largest is 177. A bigger grid holds more. A small extra square near the bottom right helps the camera correct for a code seen at an angle, and a blank border around the code, called the quiet zone, stops the camera confusing it with its surroundings.
Part of the grid also records how much error correction is used. More correction means the code can survive more damage, but holds less data.
Key takeaways
- A barcode is only a number; the shop looks up the price.
- A check digit catches misreads.
- QR codes use a two-dimensional grid.
- The corner squares show the camera where to look.
- Check the address before you open a QR link.
Now you know.
A barcode is a number.
A QR code is a grid.
Check the address before you tap.
Last reviewed 3 Nov 2026
Where next?
More in Technology
-
Read
Technology
Artificial intelligence
What AI means today: software that learns patterns from examples instead of following written rules, and…
-
Read
Technology
Fingerprint and face unlock
How fingerprint and face unlock work: a scan becomes a pattern of numbers kept on the phone and compared each…
-
Read
Technology
Bluetooth
How Bluetooth uses short-range radio to connect headphones, keyboards and speakers, why pairing is needed…