Postal Barcode Reader and Decoder SDK

Postal barcodes are rows of bars of different heights that postal operators print on letters and parcels to sort, route and track mail. barKoder reads USPS Intelligent Mail, POSTNET, PLANET, Royal Mail, KIX, Japan Post and Australia Post barcodes with the camera in your iOS, Android and web apps.

Postal barcodes

Postal barcodes at a glance

Postal barcode key facts
TypeHeight-modulated linear barcodes. The data is in the height of each bar, not its width. POSTNET and PLANET use 2 bar states (tall and short). Intelligent Mail, Royal Mail, KIX, Japan Post and Australia Post use 4 states.
Character set and dataDigits for USPS codes and the Australia Post delivery point ID. Letters and digits for Royal Mail and KIX. Digits, hyphens and control codes for Japan Post addresses.
CapacityFixed formats per operator. The Intelligent Mail barcode carries 31 digits in 65 bars. POSTNET carries up to 11 digits, PLANET 12 or 14.
Check digit and error correctionPOSTNET and PLANET add a check digit that brings the digit sum to a multiple of 10. Japan Post uses a modulo 19 check digit. Australia Post adds Reed-Solomon error correction bars.
StandardSet by each postal operator: USPS (USPS-B-3200 for Intelligent Mail, Domestic Mail Manual for POSTNET and PLANET), Royal Mail, PostNL, Japan Post and Australia Post
Typical usesAutomated letter and flat sorting, delivery point routing, mail piece tracking, mailroom intake and returns

What postal barcodes are and how they are built

Most barcodes store data in the width of bars and spaces. Postal barcodes keep every bar the same width and the same distance apart, and change only the height. That makes them easy to print fast on envelopes and easy for sorting machines to read on a moving letter.

There are two families:

  • 2-state codes: POSTNET and PLANET use tall and short bars. Each digit takes five bars, and a check digit closes the code.
  • 4-state codes: each bar is a full bar, an ascender (top half), a descender (bottom half) or a short tracker in the middle. Four states pack more data into fewer bars, so these codes can carry letters, routing data and tracking numbers.

The USPS Intelligent Mail barcode (IMb) replaced POSTNET for automation prices in January 2013. Its 65 bars hold a 20-digit tracking code and a routing code of up to 11 digits: the ZIP Code, ZIP+4 or 11-digit delivery point. The tracking code holds a barcode ID, a service type ID, the mailer ID issued by USPS and a serial number.

Each format belongs to one postal operator, so a reader has to know which formats to expect. barKoder has a separate decoder for each of the seven formats it reads.

USPS Intelligent Mail barcode with a 20-digit tracking code
A 4-state USPS Intelligent Mail barcode. The digits under it are the tracking code: barcode ID 02, service type 504, mailer ID 511505 and serial number 562874478.

Postal barcode formats barKoder reads

Seven formats from five postal operators. The last column is the decoder name to enable in the SDK.

Supported postal barcodes by country, data and bar states
FormatCountry and operatorDataBar statesDecoder
Intelligent Mail (IMb)United States, USPS20-digit tracking code plus a 0, 5, 9 or 11-digit routing code, 65 bars4PostalIMB
POSTNETUnited States, USPSZIP Code, ZIP+4 or 11-digit delivery point plus a check digit (32, 52 or 62 bars). USPS stopped accepting it for automation prices in January 2013.2Postnet
PLANETUnited States, USPS12 or 14 digits including a check digit, used to track mail pieces. Each digit is the inverse of POSTNET: three tall bars and two short ones.2Planet
Royal Mail 4-State Customer Code (RM4SCC)United Kingdom, Royal MailPostcode and delivery point suffix in letters and digits, with a checksum character4RoyalMail
KIX (Klantenindex)Netherlands, PostNLPostcode, house or PO box number and an optional suffix, for example 1231GF156X2. Uses the Royal Mail character encoding.4KIX
Japan Post Customer BarcodeJapan, Japan Post7-digit postal code and up to 13 address characters, with a modulo 19 check digit4JapanesePost
Australia Post 4-State Customer BarcodeAustralia, Australia Post8-digit delivery point ID (DPID), plus an optional customer information field. 37, 52 or 67 bars, with Reed-Solomon error correction.4AustralianPost

Where postal barcodes are scanned

Postal operators print these codes for their sorting machines. Apps outside the postal network scan them too.

Logistics and delivery

Parcel routing, proof of delivery

Couriers and delivery teams scan mail pieces and parcels at every hand-off, from the hub to the delivery vehicle. Reading the postal barcode with a phone links the item to its route and tracking record without a dedicated scanner.

Barcode scanning for logistics →

Government and customs

Postal security, inbound screening

Customs agencies use parcel tracking labels, such as USPS Intelligent Mail barcodes, to pre-scan shipments and pick packages for inspection.

Barcode scanning for government →

Warehousing and mailrooms

Intake, sorting, returns

Mailrooms and receiving docks scan incoming letters and packages to record arrival and route them inside the building. The same app can read the postal barcode and the carrier label on one item.

Barcode scanning for warehousing →

Retail and e-commerce

Returns, in-store pickup

Stores and online sellers scan returned parcels and pickup orders to match them to the original order and update stock without typing tracking numbers.

Barcode scanning for retail →

Scanning postal barcodes with barKoder

The barKoder docs list the seven postal decoders for iOS, Android, the Web SDK and Python, and for Flutter, React Native, .NET MAUI, Capacitor and Cordova apps.

One decoder per postal format

Enable only the formats your app expects, for example PostalIMB for US business mail or RoyalMail and KIX for UK and Dutch mail. All seven can run together when one app handles mail from several countries.

Web SDK API reference →

Batch MultiScan for whole labels

Decodes several barcodes in one camera view, whatever their type or size. Use it to read the postal barcode and the other codes on a shipping label in one pass.

Batch MultiScan →

Continuous scanning for mail runs

Keeps the camera reading so workers can scan item after item without pausing for each barcode. Useful for a stack of letters or a cage of parcels at a receiving dock.

Continuous scanning →

Phones instead of dedicated scanners

The SDK runs on the smartphones and tablets your team already carries, and in the browser through the WASM Barcode Scanner SDK, so a mailroom or delivery app needs no extra hardware.

WASM Barcode Scanner SDK →

Postal barcode decoder API

Turn on the postal decoders in your decoder configuration. These lines are taken from the iOS general example in the barKoder docs.

iOS (Swift)

Swift
guard let decoderConfig = barkoderView.config?.decoderConfig else { return } //get decoder config

decoderConfig.postalIMB.enabled = true
decoderConfig.postnet.enabled = true
decoderConfig.planet.enabled = true
decoderConfig.australianPost.enabled = true
decoderConfig.royalMail.enabled = true
decoderConfig.kix.enabled = true
decoderConfig.japanesePost.enabled = true

The full example enables every symbology. Keep the lines for the postal formats you need. In the Web SDK, the same decoders are Barkoder.constants.Decoders.PostalIMB, Postnet, Planet, AustralianPost, RoyalMail, KIX and JapanesePost.

Get scanning in three steps

  1. Get a free trial license and install the SDK for your platform.
  2. Enable the postal decoders for the countries your app handles.
  3. Read the decoded digits or characters in your result callback and pass them to your routing or tracking system.
See the iOS example

Decoder lists for other platforms: Android, Web SDK, Flutter, React Native, .NET MAUI, Capacitor, Cordova and Python.

Scan a postal barcode on your phone or in your browser

Install the free barKoder demo app, or open the web demo, and scan the barcodes on your own letters and parcels before you integrate the SDK.

iPhone and iPad

barKoder demo app for iOS

Scan with your camera, or point it at the QR code to open the App Store.

Download on the App Store
QR code linking to the barKoder demo app on the App Store

Android phones and tablets

barKoder demo app for Android

Scan with your camera, or point it at the QR code to open Google Play.

Get it on Google Play
QR code linking to the barKoder demo app on Google Play

Any modern browser

barKoder web demo

Runs the Web SDK in your browser, on desktop or mobile, with nothing to install.

Open the web demo
QR code linking to the barKoder web demo

Test with known samples. Print or display the testing sheet and scan each 1D and 2D barcode with the demo app. The data sheet summarizes the SDK for your team. To make your own postal test labels, the free barcode generator creates Japan Post, Australia Post and KIX barcodes.

Postal barcode scanner questions

How do I decode a USPS barcode?

Letters and flats mailed at USPS automation prices carry the Intelligent Mail barcode (IMb), a 65-bar code with four bar states. Decoding it gives you 31 digits: a 20-digit tracking code (barcode ID, service type ID, mailer ID and serial number) followed by a routing code of 0, 5, 9 or 11 digits for the ZIP Code, ZIP+4 or delivery point. In your app, enable the PostalIMB decoder in the barKoder SDK and read the digits from the result. Older mail may carry POSTNET or PLANET, which have their own decoders.

Can a phone camera read postal barcodes?

Yes. The barKoder SDK turns iOS and Android phones and tablets into postal barcode scanners, and the Web SDK does the same in a mobile or desktop browser. That lets couriers, mailrooms and returns desks scan mail with devices they already have instead of buying dedicated post office barcode scanners. Try your own mail pieces in the free demo app first.

What is the difference between POSTNET and the Intelligent Mail barcode?

POSTNET is a 2-state code of tall and short bars that holds only routing data: the ZIP Code, ZIP+4 or 11-digit delivery point and a check digit. The Intelligent Mail barcode is a 4-state code that holds the same routing data plus a 20-digit tracking code, in 65 bars. USPS stopped accepting POSTNET for automation prices in January 2013. barKoder reads both, along with PLANET, the USPS tracking code that used the inverse of the POSTNET bar pattern.

Which postal barcodes does barKoder support?

Seven formats: USPS Intelligent Mail, POSTNET and PLANET (United States), the Royal Mail 4-State Customer Code (United Kingdom), KIX (Netherlands), the Japan Post Customer Barcode and the Australia Post 4-State Customer Barcode. Each has its own decoder in the SDK: PostalIMB, Postnet, Planet, RoyalMail, KIX, JapanesePost and AustralianPost.

What does a postal code barcode contain?

It depends on the operator. US codes hold the ZIP Code and delivery point, and the Intelligent Mail barcode adds a tracking code. The Royal Mail code holds the postcode and a delivery point suffix. KIX holds the Dutch postcode and house number. The Japan Post barcode holds the 7-digit postal code and the address number. The Australia Post barcode holds an 8-digit delivery point ID. For background on postal codes themselves, read how postal barcodes work and what they mean.

Add postal barcode scanning to your app

Test the SDK on your own letters, parcels and returns with a free 30-day trial, or talk to an SDK expert about your project.