The POSTNET bar code, used by the U. S. Postal Service, is an example of a binary code. Each digit 0–9 is assigned a 5-digit binary sequence consisting of two 1's and three 0's. That sequence is then displayed as a sequence of bars, with shorter bars representing zeros and taller bars representing ones. This Demonstration lets you encode a 9-digit number along with its check digit, as well as decode a given bar code. Six fixed examples are included for decoding. The color option makes it easier to see where one encoded digit ends and the next begins.

The 50 bars of an encoded POSTNET number are preceded and followed by "guard bars". The guard bars are shown in blue when the color option is selected.

When encoding, the nine digits of the identification number may be entered in any order, but the check digit cannot be entered until all nine digits have been entered.

The check digit for a POSTNET identification number is chosen so that the sum of all 10 digits is divisible by 10.

Reference

[1] COMAP, For All Practical Purposes, New York: W. H. Freeman and Company, 2009.