Mainly used in the postal sector for letters and packaging.
Encodes a fixed amount of data; can encode postal addresses.
Follows the industry standard.


* 200 character limit for this demo.


$colorFront = new BCGColor(0, 0, 0);
$colorBack = new BCGColor(255, 255, 255);

// Barcode Part
$code = new BCGmaxicode();
$code->setColor($colorFront, $colorBack);

$code->setColor($colorFront, $colorBack);

// Drawing Part
$drawing = new BCGDrawing('', $colorBack);

header('Content-Type: image/png');


Technical Specifications

MaxiCode is an ISO international standard (IEC 16023). You are allowed to use it in your applications. It is mainly used for shipping packages.

MaxiCode is a 2D barcode that can a specific amount of information within a square symbol. All 256 characters can be encoded.
You may use multiple symbols to spread your information in order to create a bigger message.

This barcode contains a way to detect and correct errors based on the Reed Solomon algorithm. The level of correction included can be standard or enhanced.


The data encoded in the barcode comes from different code sets. Switching between code sets will impact the maximal amount of data you can use.

Here is the list of what each code set can encode. All the code sets support FS (28), GS (29), RS (30) and space (32)

  • Code Set A: Uppercase, numeric, and 15 common punctuation symbols: "#$%&'()*+,-./: and CR (13)
  • Code Set B: Lowercase and several punctuation symbols: {}~`;<=>?[\]^_,./:@!| and DEL (127)
  • Code Set C: Multilingual uppercase and other graphic characters: ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞߪ¬±²³µ¹º¼½¾€‚ƒ„…†‡ˆ‰
  • Code Set D: Multilingual lowercase and other graphic characters: àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ¡¨«¯°´·¸»¿Š‹ŒŽ‘’“”
  • Code Set E: ASCII 0-31, 149-160, 162-167, 169, 173-174, 182

Encoding always starts with code set A.


There are five modes available. Each of them include different functionality.
Select the appropriate mode for your application.

  • Mode 1: Structured Carrier Message (see further)
  • Mode 4: Standard Symbol (default)
  • Mode 5: Full EEC
  • Mode 6: Reader Programming
Mode 0 is superseded by mode 2 or 3; Mode 1 is superseded by mode 4. These two obsolete modes are not implemented.

Modes 2 and 3

These modes shall be reserved for use as a destination sortation symbol for use by carriers in the transportation industry. This message includes:

  • 3 digits class of service
  • 3 digits country code (ISO 3166)
  • postal code
In mode 2, postal code encodes up to 9 digits.
In mode 3, postal code encodes up to 6 characters from code set A.

To use one of these modes, you can use the setPrimaryMessage() method.
If you do not use this method, Barcode Bakery will try to extract the required data from the parse() method.

You can also use the generic open standard which begins by [)>RS01GS
In this case, the message looks like this:

  • yy: date (yy), followed by
  • pppppp: postal code, followed by the separator GS, then
  • aaa: country code, followed by the separator GS, then
  • bbb: class of service, followed by the separator GS, then
  • rest: optional rest of the message
If you do not provide the standard prefix, Barcode Bakery will try to extract the first three data separated by GS.


MaxiCode encodes the data in two messages called the Primary and Secondary message. For mode 4, 5 or 6, the primary and secondary message are merged to form only one.
However, the primary message always uses enhanced error correction, whereas the secondary message always uses the standard error correction unless mode 5 is selected.

Structured Append

Maxicode supports the Structured Append mode. You can spread across multiple barcodes a single message thanks to this feature.
You can use a maximum of 8 different barcodes.

Extended Channel Interpretation

{0} supports the Extended Channel Interpretation. This allows the output have interpretations different from that of the default character set.
To activate it, you have to use setAcceptECI() and use the code \xxxxxx in your message. X represents a number from 0 to 9.

You wish to encode this string: ¶Ж. Both characters are represented by the ASCII code 182. The first character is from ECI 000003 (ISO-8859-1 which is the default) and the second one is from ECI 000007 (ISO-8859-5 cyrillic).
You can proceed like this:

$code->parse(chr(182) . '\000007' . chr(182));

Please note that your Barcode Reader must support this feature.

Ready for Printing

Barcode Bakery prepares the MaxiCode for printing. At scale 1, the image is perfect for printing at 300 DPI.
However, if you want to display the barcode on the screen, you will need to resize the image with imagecopyresampled().

Barcode Bakery Supports

Encodes Characters, Numbers, Binary Available
Encodes on many codes (Structured Append) Available
Extended Channel Interpretation (Arabic, Hebrew, etc.) Available
Modes 2 and 3 for destination sortation symbol Available
Modes 0 and 1 *
Specific to .NET package
.NET 2.0+ Available
* Modes 0 and 1 are not supported anymore by the standard itself.