Maxicode

LabeljoyNew version

Maxicode is the 2D barcode of UPS: a square of small hexagons around a bull's-eye, read by sorting machines as parcels speed past. It's always the same size - print it about 1 inch (25 mm) across.

A Maxicode, a square of black hexagons around a
bull's-eye, holding Labeljoy shipping label 2026.

Encoding
Mode 2 Structured Carrier MessageA UPS shipment in the United States: the ZIP code, the country and the service class, then the rest of the UPS data - see below.
Mode 3 Structured Carrier MessageThe same, for other countries, with a postcode of letters and digits.
Mode 4 Standard SymbolAny value: the one to use outside UPS shipping, and the one a new barcode starts with.
Mode 5 Full ECC SymbolAs Mode 4, with more error correction and less room.
Mode 6 Reader ProgramA code that programs the scanner reading it.
What it holds
CharactersLetters, digits and symbols, and the accented letters of Western European languages - é, ü, ñ and the like. The euro sign, other alphabets and emoji don't fit.
LengthIn Mode 4, up to 93 letters or 132 digits; in Mode 5, 77 letters or 110 digits.
Error correctionBuilt in; more in Mode 5.
Readable textNone.

Writing Mode 2 and Mode 3. The value follows the layout UPS gives: it starts with [)>, the RS separator, 01, the GS separator and the two-digit year; then the postcode, GS, the 3-digit country code, GS, the 3-digit service class, GS, and the rest of the shipment's data; it ends with RS and EOT. Type the separators as ~030 (RS), ~029 (GS) and ~004 (EOT):

[)>~03001~02996152382802~029840~029001~0291Z00004951~029UPSN~02906X610~029159~0291234567~0291/1~029~029Y~029634 ALPHA DR~029PITTSBURGH~029PA~030~004

In Mode 2 the postcode is a ZIP code of up to 9 digits and the country is 840, the United States. In Mode 3 it's up to 6 letters and digits - lowercase is turned into capitals. What goes in the rest is in UPS's own guides.

The rest of the settings - quiet zone, color - are in the Barcode section.

What goes wrong
Input data too long.More than the Maxicode holds in that mode.
Only Latin-1 characters, the letters of Western European languages, fit in this barcode.The value has a character Maxicode can't hold - a euro sign, another alphabet, an emoji.
Invalid Mode 2 / Mode 3 structured carrier message header.Mode 2 or 3, and the value doesn't start with [)>~03001~029 and the year.
EOM (0x04 Hex) marker missing in input data.Mode 2 or 3, and the value doesn't end with ~004.
Input data missing GS.A ~029 is missing after the postcode, the country or the service class.
Invalid postcode in input data.The postcode is empty, or longer than 9 digits (Mode 2) or 6 characters (Mode 3).
Invalid length for Country Code.
Invalid length for Service Class.
The country code or the service class isn't 3 digits.
Primary data must be numeric.The country code, the service class or, in Mode 2, the ZIP code has something other than digits.
Mode 2 requires US Country Code 840.Mode 2 is for the United States: use Mode 3 for other countries.
Input data is less than mandatory UPS requirements.The value is too short for the UPS layout.