The Universal Postal Union's S10 standard, in all its glory
The Universal Postal Union's S10 standard, in all its glory
Have you ever received a parcel from overseas? I did recently, from Switzerland!
Looking at the envelope, I realised the format of the tracking number (UT038926726CH
) was in a very similar (if not identical) format to ones I'd used frequently here in the UK.
I'd been receiving emails from Royal Mail about the parcel, so I just presumed that there was some data-sharing agreement in place with Swiss Post and Royal Mail had just given the parcel their own internal reference number.
But seeing the reference number printed on the envelope from the get-go made me want to see what Swiss Post had to say about it...
The same tracking number works across multiple carriers, and it's the same format as all the UK ones! What gives??
The Universal Postal Union (UPU) is an agency of the UN that coordinates postal policies to facilitate post flowing across the world. As part of this, it publishes the S10 standard for the identification of postal items in a 13-character format - ie. what we've been seeing on our parcels!
If you're interested in learning more about the UPU's interesting 150-year history, you might want to check out this article written by fellow webring inhabitant Imaan!
Each country's national postal service is assigned as having exclusive reign over S10 codes for that country, and they go about issuing S10 codes from their country.
As it turns out, the structure of our tracking number has a strict design, and our tracking number contains four distinct things:
Character number | Format | Description |
---|---|---|
1 and 2 | 2 letters | Service indicator |
3 to 10 | 8 digits | Serial number |
11 | 1 digit | A check digit |
12 and 13 | 2 letters | ISO 3166–1 country code representing the origin of the item |
The first two characters represent the service that's been used to post the item. There's a fairly extensive list in the standard, with specific options for tracked post, letter post, parcel post... the list goes on. The most interesting part of the service indicators are threefold:
First, there are specific carve-outs in the specification for an organisation called EMS - they get all E
prefixes, so EA
, EB
, EC
, and so on and so forth. EMS is an express international mail service that's run by the UPU itself, but that delegates operations to the national postal services that control their country's S10 codes. This is why you'll not see any way to buy shipping using EMS directly on their website - you buy express international shipping at your local post office and they route it accordingly. It's also worth noting that this only applies to express shipping - not regular-rate traffic.
Second, countries are allowed to override some of the service indicator assignment rules set out in the S10 standard. This can happen when either a parcel is being sent domestically or when a carrier has an agreement with other countries' carriers to reassign some service indicators for other purposes, hence the inclusion of the origin country code to aid interpretation of tracking numbers where this is the case.
Lastly, some service indicators are explicitly disallowed from being used. These are JA–JZ
, KA–KZ
, SA–SZ
, TA–TZ
and WA–WZ
since these carry the risk of causing a tracking number to be confused with codes from a different UN data encoding standard.
All in, the possible service indicator space looks like this:
This is just a serial number. It's exactly 8 digits long and is generated by the originating carrier as they see fit, provided they don't resue the same number within 12 months. In theory, this means a lost parcel can only be lost for 12 months before it vanishes from the world forever, but in reality, the S10 recommends not reusing a number within a minimum period of 24 months. Even then, you have 10 million parcels per service indicator per country available to be issued, so it's probably not going to be necessary for a carrier to reuse a number for a much longer period of time anyway.
The check digit corrects any errors in the serial number preceding it, using the following algorithm:
8 6 4 2 3 5 9 7
This is not a particularly strong checksum, but it's good enough to guard against a couple of accidental digit-swaps here and there. You can play with an interactive demo of it here.
The S10 standard requires tracking numbers to be printed on an item as a barcode, either being in Code 128 or Code 39 format.
Additional barcodes on the label are discouraged, particularly for international items, and carriers that must include other barcodes are required to use a different format and not obscure the S10 code. This is why you'll see Royal Mail, for example, using data matrices on their labels.
AB 123 456 789 GB
With a limit of 10 million different serial numbers, I wonder how China does it. I can't come up with a decent estimate, and maybe I'm way off. But with the growth of sellers like Shein or Temu, I wouldn't be surprised if they shipped that many parcels in like a single day ? Or at least in a timeframe short enough that they would have over 10 million shipped but yet-to-be-delivered parcels, effectively running out of tracking numbers.
What helps is that they don’t ship direct from China by mail much. They often send in bulk to the destination country and then mail locally, and local post systems can have their own domestic format.
Or they have their own private courier do the last mile delivery too so it never touches any postal operator.
Do they? In Australia usually get them direct from HK or China because it is cheaper to do that even than post it within Australia!
In Southern Ontario Canada, yes, even in the suburbs, most stuff is dropped off by some rando courier for a few years now.
Somehow cheaper than paying bulk international airmail rates.
> With a limit of 10 million different serial numbers, I wonder how China does it.
The author has issued a correction, it's 100 million numbers per service indicator. But even then, it's probably not enough.
The boring answer is that your shipping options are either get untracked postal service (which the S10 standard does not apply) or use a private courier (which also does not use the S10 standard).
If you insist, you got two options for UPU-based postal tracking: normal e-commerce parcel aka H-codes, practically 2,300,000,000 trackable packages per year [1]. EMS is the other route, and there are another 2,300,000,000 trackable packages per year [2]. However, in my experience tracked postal delivery is only used in certain countries where it is more advantageous than private delivery (like until very recently in the US, for complicated reasons [3]), while other destinations has a more-than-willing private delivery partner (that is not the Big Three [4]) or even set up the delivery systems themselves.
1: 23 service indicators: HA-HW, HX-HZ are reserved for multilateral/bilateral use only
2: another 23 service indicators: EA-EW, EX-EZ are reserved for multilateral/bilateral use only
3: https://www.thewirechina.com/2020/11/22/delivering-chinas-ma... https://www.ft.com/content/a1233f3e-d21a-11e8-a9f2-7574db66b...
4: DHL, FedEx, and UPS
Yeah. Apparently last year they shipped over two million small parcels to Finland (pop. 5.6M) alone, which is completely bollocks.
> completely bollocks
Do you mean “bonkers”? Because “bollocks” in this case would mean “made up”.
Oops, yes!
Service type and serial need to be unique. Countries control what that 2letter field means. There is no rule against multiple codes indicating the same service. So AA through AZ would give you 260,000,000 unique combinations that you shouldn’t reuse for 1 year. Rinse, later and repeat if you need more.
Is the serial number even in base 10? the other parts of the number allow letters, the article does not say, but it could easily be base 36. which is close to 3 trillion serials.
Plus a bonus rant: this is one of those things that looks like a number and as such you are tempted to use a number to store it, but its not, it's a string, you will never do math on it so it is not a number. see also: phone numbers, social security numbers, serial numbers.
and sheepish bonus update: there is a checksum, so math is done on it. wonder if the checksum makes more or less sense in base 36? probably less, the checksum almost looks base12-ish, the mod(11), but there are special cases for two digit values so it is probably base 10.
Eh, your comment here was checksummed several times as well crossing the network. Doesn't make it "a number".
You could hate it by an internal metric, like date received.
And I wonder what was the constraint to not make it longer when they developed the standard. Making it a few digits more seem it wouldn't cost much.
The cost will be in updating every legacy postal system that currently has fixed column lengths/input field length limits.
Even the US must easily run into this constraint.
The short answer is probably : in-house consolidation.
Does anyone know what's going on with the DataMatrix code next to the address on some mail, such as periodicals such as magazines, which contains the full name and address of the recipient in what looks to be a standardized format with field separators?
Does that complex algorithm for the check digit have any advantage over the much simpler algorithm used for EANs or 13-digit ISBNs?