CPC Binary Barcode

CPC Binary Barcode is Canada Post's proprietary symbology used in its automated mail sortation operations. This barcode is used on regular-size pieces of mail, especially mail sent using Canada Post's Lettermail service. This barcode is printed on the lower-right-hand corner of each faced envelope, using a unique ultraviolet-fluorescent ink.

Symbology description

The applied barcode uses printed and non-printed bars spaced 3 mm apart, and consists of two fields. The rightmost field, which is 27 bars in width, encodes the destination postal code. The leftmost field is 9 bars in width and applied right below the printed destination address. It is currently unclear what this field is used for.

In the postal code field, the rightmost bar is always printed, to allow the sortation equipment to properly lock onto the barcode and scan it. The leftmost bar, a parity field, is printed only when necessary to give the postal code field an odd number of printed bars. The remaining 25 bars represent the actual destination postal code. To eliminate any possibility of ambiguity during the scanning process, run-length restrictions are used within the postal code field. No more than five consecutive non-printed bars, or spaces, are permitted, and no more than six consecutive printed bars are allowed.

The actual representation of the postal code is split into four subfields of the barcode, each with their own separate encoding table. The first and last subfields, which share a common encoding table, are always eight bars in width, and encode the first two characters and the last two characters of the postal code respectively. The second subfield, which encodes the third character of the postal code, is always five bars in width, and the third subfield, which encodes the fourth character, is always four bars wide.

Generating barcodes

  1. Disregarding the space, divide the postal code into four subfields (e.g. K1-A-0-B1).
  2. Locate the contents of each subfield in the encoding tables below and record the hexadecimal numbers that they correspond to. (e.g. K1-A-0-B1 becomes 32-07-A-C2.)
  3. Convert those hex numbers to binary, and add leading zeroes where required.
  4. Change the binary numbers into bars. "Zero" bits in the resulting binary numbers correspond to spaces in the barcode, while "one" bits correspond to printed bars, with the least significant bit of each number corresponding to the rightmost bar in each subfield of the barcode.
  5. Add an "alignment" bar onto the end of the resulting barcode.
  6. Count up the number of bars you have. If you get an even number, add another bar onto the start of the barcode.

Here are some examples of encoded postal codes. The colour used in these examples is meant to simulate the actual colour of the ink used to print the barcodes, however it does not exactly match. Select these examples to make them more visible.

A1B 2C3: | |||  |  ||  |  || ||  |||
K1A 0B1: |  ||  |   |||| | ||    | |
V6B 2R5: |   | ||  ||  |  | | | | ||

Encoding tables

Note that postal codes use only 20 letters; six letters (D, F, I, O, Q, U) are never used. Unused codepoints are indicated with dashes.

First and fourth fields (8 bits)
 00: ––  01: ––  02: ––  03: ––   04: ––  05: ––  06: ––  07: ––   08: ––  09: ––  0A: ––  0B: ––   0C: ––  0D: ––  0E: ––  0F: –– 
10: ––11: X012: V113: V314: X115: V516: V617: V7 18: ––19: V21A: V01B: V41C: X21D: V81E: V91F: ––
20: Z121: N122: L123: L324: T125: L526: L627: L7 28: W129: L22A: L02B: L42C: P12D: L82E: L92F: ––
30: Z331: N332: K133: K334: T335: K536: K637: K7 38: W339: K23A: K03B: K43C: P33D: K83E: K93F: ––
40: ––41: X342: M143: M344: X445: M546: M647: M7 48: ––49: M24A: M04B: M44C: X54D: M84E: M94F: ––
50: Z551: N552: R153: R354: T555: R556: R657: R7 58: W559: R25A: R05B: R45C: P55D: R85E: R95F: ––
60: Z661: N662: J163: J364: T665: J566: J667: J7 68: W669: J26A: J06B: J46C: P66D: J86E: J96F: ––
70: Z771: N772: A173: A374: T775: A576: A677: A7 78: W779: A27A: A07B: A47C: P77D: A87E: A97F: ––
80: ––81: ––82: H183: H384: X985: H586: H687: H7 88: ––89: H28A: H08B: H48C: ––8D: H88E: H98F: ––
90: Z291: N292: G193: G394: T295: G596: G697: G7 98: W299: G29A: G09B: G49C: P29D: G89E: G99F: ––
A0: Z0A1: N0A2: S1A3: S3A4: T0A5: S5A6: S6A7: S7 A8: W0A9: S2AA: S0AB: S4AC: P0AD: S8AE: S9AF: ––
B0: Z4B1: N4B2: C1B3: C3B4: T4B5: C5B6: C6B7: C7 B8: W4B9: C2BA: C0BB: C4BC: P4BD: C8BE: C9BF: ––
C0: ––C1: X6C2: B1C3: B3C4: X7C5: B5C6: B6C7: B7 C8: ––C9: B2CA: B0CB: B4CC: X8CD: B8CE: B9CF: ––
D0: Z8D1: N8D2: E1D3: E3D4: T8D5: E5D6: E6D7: E7 D8: W8D9: E2DA: E0DB: E4DC: P8DD: E8DE: E9DF: ––
E0: Z9E1: N9E2: Y1E3: Y3E4: T9E5: Y5E6: Y6E7: Y7 E8: W9E9: Y2EA: Y0EB: Y4EC: P9ED: Y8EE: Y9EF: ––
F0: ––F1: ––F2: ––F3: ––F4: ––F5: ––F6: ––F7: –– F8: ––F9: ––FA: ––FB: ––FC: ––FD: ––FE: ––FF: ––
Second field (5 bits) Third field (4 bits)
00: 01: 02: L03: K04: M05: R06: J07: A 0: 1: 2: 13: 3
08: H09: G0A: S0B: C0C: B0D: E0E: Y0F: 4: 5: 56: 67: 7
10: 11: V12: 13: X14: T15: 16: N17: 8: 9: 2A: 0B: 4
18: W19: 1A: Z1B: 1C: P1D: 1E: 1F: C: D: 8E: 9F:

No field begins or ends with more than three consecutive 1 bits, guaranteeing that there are never more than six consecutive 1 bits. Guaranteeing the five-bit limit on consecutive 0 bits is achieved by limiting the boundaries of the second and fourth fields to three consecutive 0 bits, and the first and third fields to two consecutive 0 bits:

  • No field contains more than five consecutive 0 bits. Code 81, which would contain six consecutive 0 bits in field 1 or 4, is not used.
  • Field 1 never ends in more than two consecutive 0 bits. Codes that end in three or more consecutive 0 bits encode the letters Z or W, which are not used for the first letter of postal codes.
  • Field 2 may begin or end with at most three consecutive 0 bits.
  • Field 3 never begins with more than two consecutive 0 bits, nor does it ever end with more than one.
  • Field 4 may begin with up to three consecutive 0 bits, and may end with up to five consecutive 0 bits, but is always followed by a 1 bit (the alignment bar).


gollark: Okay, listening.
gollark: I would ask for krist, but it's centralized and the server went down due to backup issues.
gollark: No. You insulted potatOS. You must pay.
gollark: yesthat is my pastebin username
gollark: So is crOSs now.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.