Skip to content

BLOG

QR Codes, Barcodes, and Data Matrix: How Machine-Readable Codes Actually Work

April 13, 2026 · 13 min read

QR codes were everywhere during the pandemic: restaurant menus, vaccination records, contact tracing, payment systems. But the technology dates back to 1994, when Denso Wave, a Toyota subsidiary, invented it to track automotive parts on assembly lines. The format was designed to be scanned at any angle, at high speed, even when partially damaged. That robustness is why it survived the transition from factories to consumer smartphones.

This guide covers how QR codes work, how they compare to traditional barcodes and Data Matrix codes, and when to use each format.

How QR Codes Work

QR stands for Quick Response. A QR code is a two-dimensional matrix of black and white squares (called modules) arranged on a square grid. The three large squares in the corners are finder patterns. They let the scanner detect the code's position and orientation regardless of how the phone is held.

Inside a QR code:

  • Finder patterns (3 corners): Position detection. The fourth corner has a smaller alignment pattern.
  • Timing patterns: Alternating black and white modules between finder patterns that help the scanner determine grid spacing.
  • Format information: Encodes the error correction level and mask pattern.
  • Version information: For larger QR codes (version 7+), this area stores the version number.
  • Data and error correction: The actual encoded information, plus Reed-Solomon error correction codes.

Error correction levels:

LevelRecovery CapacityBest For
L (Low)7%Clean environments, digital screens
M (Medium)15%General use (most common)
Q (Quartile)25%Outdoor signage, potentially dirty conditions
H (High)30%Logos in center, high damage risk

Level H lets you place a logo in the center of the QR code (covering up to 30% of the modules) and still have it scan correctly. This is why branded QR codes work, though you should always test after adding a logo.

The QR Code Generator creates codes for URLs, text, email addresses, phone numbers, and more. You can adjust error correction level and size.

QR Code Data Types

QR codes can encode different types of data, and scanners interpret them differently based on the content:

ContentFormatPhone Action
URLhttps://example.comOpens browser
Emailmailto:name@example.comOpens email app
Phonetel:+15551234567Opens dialer
SMSsms:+15551234567?body=HelloOpens messaging
WiFiWIFI:S:NetworkName;T:WPA;P:Password;;Connects to network
vCardBEGIN:VCARD... END:VCARDAdds contact
Calendar eventBEGIN:VEVENT... END:VEVENTCreates event
Plain textAny stringDisplays text

WiFi QR codes are particularly useful. Instead of spelling out your WiFi password to guests, generate a QR code with the WiFi QR Generator. Guests scan it and connect automatically. No typing, no mistakes, no sharing the password verbally.

Traditional Barcodes (1D)

The black-and-white stripes on product packaging are one-dimensional barcodes. They encode data in a single horizontal direction using varying widths of bars and spaces.

Common barcode formats:

FormatCharactersCommon Use
UPC-A12 digitsUS/Canadian retail products
EAN-1313 digitsInternational retail products
Code 128All ASCIIShipping, logistics, inventory
Code 39A-Z, 0-9, symbolsAutomotive, defense, healthcare
ITF-1414 digitsOuter shipping cartons
Codabar0-9, symbolsFedEx, blood banks, libraries

The Barcode Generator creates barcodes in multiple formats. Enter the data, select the format, and download the barcode as an image ready for printing.

1D barcodes vs. QR codes:

  • Barcodes are simpler and cheaper to print (less ink, easier to laser-etch)
  • Barcodes hold less data (typically 20-25 characters vs. QR's 4,296 alphanumeric)
  • Barcodes require a specific scanning angle; QR codes scan from any direction
  • Barcodes are narrower and fit in tight horizontal spaces; QR codes are square

Data Matrix Codes

Data Matrix is another 2D code format, competing with QR. It looks similar to a QR code but has a solid border on two sides (the "L-shaped" finder pattern) and a dotted border on the other two sides.

Data Matrix vs. QR:

FeatureQR CodeData Matrix
Maximum data7,089 numeric / 4,296 alphanumeric3,116 numeric / 2,335 alphanumeric
Minimum size21x21 modules10x10 modules
Error correction7-30% (selectable)Up to ~30% (ECC 200)
Consumer recognitionVery high (post-pandemic)Low (mostly industrial)
Industry useMarketing, payments, contact infoElectronics, pharmaceuticals, aerospace
Print at tiny sizesPossible but limitedExcellent (designed for small parts)

Data Matrix dominates in manufacturing because it can be printed extremely small, even laser-etched directly onto electronic components. The pharmaceutical industry uses it for drug packaging serialization, mandated by regulations in the EU, US, and many other markets.

Practical QR Code Tips

Size matters. The minimum recommended scanning distance is 10 times the module (individual square) size. For a QR code with 1mm modules, the scanning distance is about 10cm. For a billboard viewed from 10 meters, the modules need to be at least 10cm each, making the total code roughly 3 meters wide.

Contrast is essential. Black on white works best. Dark blue on light grey is fine. Red on green is terrible (and inaccessible). The scanner needs clear contrast between the modules and the background.

Do not invert colors casually. White modules on a black background sometimes confuse older scanners. If you must invert for aesthetic reasons, test thoroughly with multiple devices.

Short URLs produce smaller QR codes. A QR code encoding "https://fasttool.app" is much smaller (fewer modules) than one encoding a 200-character tracking URL. Use URL shorteners when the QR code needs to be printed small.

Static vs. dynamic QR codes. A static QR code has the data baked in permanently. A dynamic QR code points to a redirect URL that you control, letting you change the destination after printing. Dynamic codes are offered by commercial QR services; static codes are what free generators produce, and they work perfectly for permanent content.

Security Considerations

QR codes can point to malicious URLs. A code on a public poster or business card could direct your phone to a phishing site, a malware download, or a fake payment page. Most modern phone cameras show the URL before opening it, which helps, but not everyone reads the preview carefully.

Best practices:

  • Always check the URL preview before opening a scanned QR code
  • Be suspicious of QR codes stuck on top of other QR codes (common in payment fraud)
  • Do not scan QR codes from untrusted sources, especially for payments
  • If generating QR codes for your business, use HTTPS URLs and your own domain

The QR Code Generator, Barcode Generator, and WiFi QR Generator all run in your browser with no server interaction. The codes are generated locally, and no data about what you encode is transmitted anywhere.