What Is Inside the Bullseye Code on a Shipping Label (MaxiCode)? | How the Postal Code, Country Code and Service Class Are Laid Out, and Reading One Cropped from a Label Photo
The 2D code with a round bullseye in the middle on parcel labels is called MaxiCode. Using an in-browser MaxiCode generator and reader, we encode and decode a code to see how the postal code, country code and service class are arranged in the structured data of modes 2 and 3. Real screenshots also show that postal codes are padded to 9 digits with trailing zeros and that a whole-label image cannot be read without cropping.
Contents
In the corner of courier waybills and international shipping labels you may find a 2D code with a round bullseye pattern in the middle, surrounded by small hexagonal dots. It is neither a QR code nor a linear barcode. This shape is called MaxiCode, and it has long been used so that sorting machines can read the postal code and type of delivery service in an instant.
Because it looks like nothing more than a pattern to people, it is hard to tell what is stored inside, or whether it is fine to photograph and read the label on your own parcel. In this article we use both a MaxiCode generator and a MaxiCode reader: we create a code containing a postal code and other values, read it back, and check how the contents are arranged. We also show, with real screenshots, where reading from a label photo tends to go wrong. Both tools run entirely in your browser, and neither images nor typed text are sent anywhere.
The contents: postal code, country code, service class, then text
MaxiCode has several “modes” for different purposes. The MaxiCode Generator on this site lets you choose from these four.
| Mode | Purpose | What goes in |
|---|---|---|
| 2 | Shipping data (numeric postal code) | Postal code (1–9 digits), country code, service class, following text |
| 3 | Shipping data (alphanumeric postal code) | Postal code (1–6 alphanumeric characters), country code, service class, following text |
| 4 | General text | A string (standard error correction) |
| 5 | General text | A string (stronger error correction, so it holds less) |
Parcel labels use mode 2 or 3. The three values needed for sorting come first in a fixed order, followed by free additional text. The country code is the 3-digit numeric ISO 3166-1 code (840 for the United States, 392 for Japan), and the service class is a 3-digit number defined by the carrier. What a service class means (next-day, ground and so on) differs from carrier to carrier and cannot be told from the code alone. Here we only check how the values are arranged.
Create a code, then read it back
Before photographing and reading a real label, it is worth checking the reader’s output with a code whose contents you already know. In the generator we entered the following.
| Field | Input |
|---|---|
| Text to encode | ORDER-1042 BOX 1/2 |
| Mode | 2: Shipping data (numeric postal code) |
| Postal code | 123456789 |
| Country code | 840 |
| Class of service | 001 |
Setting Mode to 2 reveals the “Shipping data” fields. The preview updates as you type; once it shows “Mode 2 / text 18 UTF-8 bytes / PNG 451 × 431 px”, save it with “Save as PNG”.
Opening the saved PNG in the MaxiCode Reader starts decoding as soon as the image is selected. The “Decoded text” was:
123456789␝840␝001␝ORDER-1042 BOX 1/2
␝ is GS (group separator, control character 0x1D) and is invisible on screen. Open “Show control characters” under the result and it is shown by name as 123456789⟦GS⟧840⟦GS⟧001⟦GS⟧ORDER-1042 BOX 1/2. In other words, the decoded string consists of four parts separated by GS: postal code, country code, service class and additional text, 36 characters in total. If you write your own parser, split on GS and take the first three fields.
Watch out: postal codes are padded to a fixed length
Because each mode has a fixed postal code length, shorter values are padded when read back. Testing with the same tools gave the following.
| Input when creating | Start of the decoded string | Why |
|---|---|---|
Mode 2, 00501 |
005010000 |
Zeros are added on the right until it has 9 digits |
Mode 2, 12345 |
123450000 |
Same as above |
Mode 3, AB1 |
AB1 (three trailing spaces) |
Spaces are added on the right until it has 6 characters |
If you put the 5-digit US ZIP code 12345 into mode 2, the result reads 123450000, which cannot be distinguished from a ZIP+4 whose last four digits really are 0000. When the last four digits read 0000, the code alone cannot tell you whether the original had no +4 part or it was actually 0000. If your process needs that distinction, do not rely only on the code value; compare it with the text printed on the label.
The additional text can also be UTF-8, and a mode 2 code containing 日本語 ORDER (Japanese characters followed by ORDER) read back correctly. However, each such character takes several bytes, so fewer characters fit than with plain letters and digits.
A photo of the whole label won’t read: crop to the code
Next we tried something closer to a real label. We placed the code on a fictional label (800 × 560 px) alongside an address, a linear barcode and tracking number text. It is not a real carrier’s label, only a mock-up for this article.
Selecting this label PNG in the reader as-is gave this result:
No MaxiCode could be read. Select one code and its white margin again. Leave no text or frame outside the code, and use an image that is not tilted or blurry.
When given the whole image, the reader cannot find the code. As the tool explains, it expects a straight-on image showing only the code, and detection fails when addresses or barcodes surround it. When a photo of a label “won’t read”, this is usually why.
After you select an image, a blue dashed frame appears in the preview. Resize it to enclose only the code and its white margin. You can drag to draw the frame or type the four numbers under “Crop area”. Here we set Left X to 8, Top Y to 222, Width to 275 and Height to 262, and pressed “Read selection”.
Keep dark areas such as address text, tracking numbers and the label’s border out of the crop frame as much as possible. This tool does not correct the distortion of a code photographed at an angle with a smartphone. Shoot as straight-on and in focus as you can, and if it still fails, change the orientation with “Rotate 90° left / right” (the four orientations are tried automatically).
Think before reading the code on a parcel label
A label’s code holds the recipient’s postal code and the type of delivery. What goes into the additional text depends on the agreement between the shipper and the carrier, and it may well include a number that identifies the parcel. A photo of the whole label also shows the address and tracking number, so avoid posting it on social media. The same reasoning appears in our article on boarding passes (What is inside the PDF417 barcode on a paper boarding pass). If you do need to share a photo, black out the address and the code first with the Image Redaction Tool.
The reader on this site only displays the decoded string on screen; even if it contains a URL, nothing is opened automatically. Use it for checking codes you created yourself or the label on a parcel you received.
When you create MaxiCodes yourself
If you print MaxiCodes on outgoing shipping labels, follow the steps above to create a code, read it back and check that the values are arranged as intended. To create many codes at once, Bulk MaxiCode PDF from CSV generates them from a CSV and lays them out in a PDF. Whether a label will actually be accepted by a carrier, however, depends on its specifications, including service class values, print size and margins. Being able to make the image with this tool does not mean the label meets those requirements.