Learn · DataMatrix Codes

DataMatrix Codes Explained

A deep dive into the DataMatrix barcodes on Royal Mail stamps — the technology behind them, the JGB strings they encode, and what collectors need to know.

Illustrative DataMatrix pattern

What you're looking at

A DataMatrix code is a two-dimensional matrix barcode. The solid L-shaped border on two sides (the "finder pattern") helps scanning equipment orient the code correctly. The dotted border on the other two sides (the "timing pattern") defines the grid dimensions.

The interior cells encode the data — each black or white cell represents a binary digit (1 or 0), and together they form the encoded string.

What is a DataMatrix Code?

DataMatrix is an international standard for two-dimensional matrix barcodes (ISO/IEC 16022). It was developed in the 1980s and is widely used in industrial, medical, and postal applications where a large amount of data needs to be encoded in a small physical space.

Unlike a QR code (which uses square modules arranged in a square grid with three corner markers), a DataMatrix code uses a distinctive L-shaped solid border on two sides and an alternating border on the other two sides. This structure allows scanning equipment to determine the code's orientation and size before reading the data.

DataMatrix vs QR Code

FeatureDataMatrixQR Code
StandardISO/IEC 16022ISO/IEC 18004
ShapeSquare or rectangularSquare only
Finder patternL-shaped solid borderThree corner squares
Data capacityUp to 2,335 alphanumeric charsUp to 4,296 alphanumeric chars
Minimum sizeVery small (2×2mm practical)Slightly larger minimum
Royal Mail useYes — all barcoded stampsNo

JGB Strings: What's Inside the Barcode

When the DataMatrix code on a Royal Mail barcoded stamp is decoded, it produces a text string beginning with JGB_ — the UPU Country Code identifying it as a UK postal DataMatrix. This is followed by a structured sequence of fields encoding everything about that individual stamp.

Real Example — 2nd Class Machin Barcoded Stamp

JGB_Country
SStamp
1Version
1Format
2Class
3Origin
173011Supplier
43694Pane
01Stamp#
00066Value
231120Date
01Cycle
DB40E4…Security
JGB_ — UPU Country Code — UK postal identifier
S — Indicates item is a Stamp
Format 1 — 1 = Letter, 2 = Large Letter
Class 2 — 1 = 1st Class, 2 = 2nd Class
Origin 3 — 1=Bk4 · 2=Bk8 · 3=Bk50 · 5=Sheet · 7=Mini
173011 — Supplier code — 173011 = ISP
00066 — Notional value in pence (66p = 2nd Class)
231120 — Date of barcode generation (DDMMYY)
Security — Further characters used by Royal Mail's own systems

Format Codes

1Letter
2Large Letter

Class Codes

11st Class
22nd Class

Origin Codes

1Booklet of 4
2Booklet of 8
3Booklet of 50
5Counter Sheet
7Mini Sheet

Decoding a Barcode Stamp

The Modern GB Stamp Decoder App is designed specifically to scan and interpret the DataMatrix codes on Royal Mail barcoded stamps. When you scan a stamp with the app, it:

  • Reads the barcode with your phone's camera
  • Shows the value, colour, issue, print date and origin in plain collector terms
  • Matches the stamp to its entry in the Modern GB catalogue
  • Keeps the raw barcode data there for those who want it
  • Saves the stamp to your collection, Mint or Used