Click here to Skip to main content
13,706,038 members
Click here to Skip to main content
Add your own
alternative version


52 bookmarked
Posted 20 Sep 2007
Licenced Apache

USPS OneCode Barcodes

, 3 Oct 2008
Rate this:
Please Sign up or sign in to vote.
USPS One Code - Intelligent Mail Barcode (4-State Customer Barcode) - implementation with VB 2008


This is not a typical article. The focus is on Intelligent Mail Barcode (4 State Customer Barcode) or USPS OneCode implementation as a direct solution for anyone who needs it. The downloads include one VB.NET and one C# class – VS2008 with .NET 3.5 syntax - that generate the string expression of OneCode barcodes and decode a barcode string. The code (uncommented) is a modified fraction of the Pathenon project (covers all known 1D and 2D barcodes) that you will read here on The Code Project in the near future, hopefully. I've noticed that there is no related article, so there you are with an ASAP solution for this new USPS symbology.

Basic Information

Intelligent Mail Barcode, also known as the USPS OneCode Solution or USPS 4-State Customer Barcode (abbreviated 4CB, 4-CB, or USPS4CB), is the latest barcode symbology of the United States Postal Services. It combines routing ZIP code information and tracking information into a single 4-state code. It effectively encodes data from POSTNET and PLANET barcodes into a single barcode while providing a greater range of tracking data.

A 4-state barcode is based on a tracker with ascenders and descenders. The four possible states are tracker (neither ascender nor descender), full (both ascender and descender), ascender only, and descender only. The Intelligent Mail barcode consists of 65 bars as a result of encoding data fields of the following types:

Tracking Code

  • Barcode Identifier as 2 digits (2nd digit must be 0–4)
  • Service Type Identifier as 3 digits
  • Mailer Identifier as 6 or 9 digits and
  • Serial Number as 9 (when used with 6 digit Mailer ID) or 6 (when used with 9 digit Mailer ID) digits

Routing Code

  • Delivery Point ZIP Code as 0, 5, 9, or 11 digits

The above fields, with a maximum of 31 digits in length, are encoded via a complex process (involving big integers and transposed lookups) to bars expressed as a string with 65 characters in the range of A, D, T, F. More information and specifications can be found here.


Note once again that this is not a typical article, but a direct solution for people dealing with this complex barcode symbology.

Thanks for your time.


This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


About the Author

You may also be interested in...

Comments and Discussions

QuestionMessage Closed Pin
1-Aug-13 16:07
memberjacaboo1-Aug-13 16:07 
QuestionAdded the fixes mentioned in the comments to C# code Pin
Deepfreezed31-Jul-13 4:55
memberDeepfreezed31-Jul-13 4:55 
QuestionMessage Closed Pin
22-Jan-13 16:11
member22-Jan-13 16:11 
QuestionMessage Closed Pin
15-Feb-12 22:32
membersteve7g15-Feb-12 22:32 
AnswerRe: transportation barcode Pin
sybil_9-Oct-12 16:53
membersybil_9-Oct-12 16:53 
QuestionMessage Closed Pin
15-Feb-12 22:16
membersteve7g15-Feb-12 22:16 
QuestionMessage Removed Pin
9-Jan-12 4:07
memberKeepDynamic9-Jan-12 4:07 
GeneralMy vote of 4 Pin
the headlessnick2-Aug-11 0:52
memberthe headlessnick2-Aug-11 0:52 
GeneralDecoder in plan C Pin
19-Sep-10 15:22
member19-Sep-10 15:22 
AnswerRe: Decoder in plan C Pin
the retired19-Sep-10 21:57
memberthe retired19-Sep-10 21:57 
GeneralBarcode Pin
Jones xxx26-May-09 13:19
memberJones xxx26-May-09 13:19 
Generalhelp pls.... Pin
lakshmi priya.t.n29-Jan-09 17:41
memberlakshmi priya.t.n29-Jan-09 17:41 
AnswerRe: help pls.... Pin
the retired31-Jan-09 11:47
memberthe retired31-Jan-09 11:47 
GeneralCompilation error Pin
robertjb207-Jan-09 9:45
memberrobertjb207-Jan-09 9:45 
AnswerRe: Compilation error Pin
the retired8-Jan-09 5:14
memberthe retired8-Jan-09 5:14 
GeneralHere is another Implementation for .Net (C#) using USPS provided dll and fonts Pin
13-Nov-08 8:43
member13-Nov-08 8:43 
QuestionSample application Pin
amarbank23-Nov-10 6:38
memberamarbank23-Nov-10 6:38 
GeneralRe: Here is another Implementation for .Net (C#) using USPS provided dll and fonts Pin
crobbins6-Jan-11 8:56
membercrobbins6-Jan-11 8:56 
GeneralRe: Here is another Implementation for .Net (C#) using USPS provided dll and fonts Pin
sjtorres15-Jun-11 8:12
membersjtorres15-Jun-11 8:12 
QuestionRe: Here is another Implementation for .Net (C#) using USPS provided dll and fonts Pin
bendece25-Feb-11 16:09
memberbendece25-Feb-11 16:09 
QuestionIncorrect Decode Example Pin
voxdisc10-Nov-08 16:35
membervoxdisc10-Nov-08 16:35 
AnswerRe: Incorrect Decode Example Pin
bheiland22-May-09 2:15
memberbheiland22-May-09 2:15 
GeneralRe: Incorrect Decode Example Pin
Gylfi Ingvason27-May-09 8:59
memberGylfi Ingvason27-May-09 8:59 
GeneralRe: Incorrect Decode Example Pin
bheiland27-May-09 13:59
memberbheiland27-May-09 13:59 
AnswerRe: Incorrect Decode Example Pin
bheiland27-May-09 14:04
memberbheiland27-May-09 14:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04-2016 | 2.8.180920.1 | Last Updated 3 Oct 2008
Article Copyright 2007 by the retired
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid