POSTNET Barcodes

Being a resident in the U.S., I often see mail come to my home address with bar codes on it. I never paid much attention to them. Today that changed. I dug around and found that these are called POSTNET Barcodes. Each digit is represented by 2 tall bars and 3 short bars.

At first, I thought it was setup on the base-2 system. Base 2 would represent each tall bar with the values of 16, 8, 4, 2 and 1 in respect to the bars placement. The POSTNET system assigns the values of 7, 4, 2, 1 and 0. So if I wanted to represent the digit 5, I would choose bars representing 4 and 1 “.l.l.”. In binary, it would have been “..l.l”. The binary system would also pose a problem in that there are 21 extra numbers that would never be used.

This new numbering system causes a problem with the digit zero since you “must” choose 2 bars. Looking at all the possible combinations, you can see that 7 and 4 equal 11. Since 11 is not a single digit, this combination is used instead to represent zero. So here is a break down of each digit:

  1. …ll
  2. ..l.l
  3. ..ll.
  4. .l..l
  5. .l.l.
  6. .ll..
  7. l…l
  8. l..l.
  9. l.l..
  10. ll…

So now we all know the numbers. There are three types of barcodes. Now lets look at the format of the barcode. Here are mine:

Zip: 22191 (5)
l..l.l..l.l…lll.l…..ll.l.l.l

Zip+4: 22191-4248 (7)
l..l.l..l.l…lll.l…..ll.l..l..l.l.l..ll..l.l…ll

Zip+4 and Data Point: 22191-4248-26 (9)
l..l.l..l.l…lll.l…..ll.l..l..l.l.l..ll..l…l.l.ll..l.l..l

Each barcode begins and ends with a full line. The first 5 digits are your Zip Code. The next 4 (if present) are your Zip+4 address. If you have a PO Box, or a building number, then you may also have the last two digits of the number representing the delivery point. My house number is 15826, so the last two digits (26) are used.

You may have noticed that each code also has an additional digit at the end. It helps the scanner to confirm that it read the scan correctly. To figure out the code, you add the sum of all digits. Next, you determine the difference between it and the next number divisible by 10. That is your check digit.

2 + 2 + 1 + 9 + 1 = 15 (+5 = 20)
2 + 2 + 1 + 9 + 1 + 4 + 2 + 4 + 8 = 33 (+7 = 40)
2 + 2 + 1 + 9 + 1 + 4 + 2 + 4 + 8 + 2 + 6 = 41 (+9 = 50)

Just for fun, I put together a little javascript code for you to experiment with:

5-Digit Zip Code:
+4 Code:
Delivery Point:
POSTNET:
POSTNET Values:

Tags: , , , , ,

One Response to “POSTNET Barcodes”

  1. Nick Says:

    Oh man, that’s the sort of thing that I’d do, but not openly admit. Well done, and that little program is cool.

Leave a Reply