The POSTNET Bar Code

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

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.

Contributed by: Marc Brodie (July 2011)
Wheeling Jesuit University
Open content licensed under CC BY-NC-SA



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.


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

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.