whereparcel

Stuck on integration? Have a question? The developer is standing by.

Guide 9 min read

Understanding Tracking Number Formats by Carrier

A comprehensive guide to tracking number formats from major carriers worldwide. Learn how to identify carriers from tracking numbers automatically.

WhereParcel Team

Every carrier has a unique tracking number format. Understanding these formats helps with carrier auto-detection, input validation, and debugging tracking issues. This guide covers the most common formats from major carriers worldwide.

Why Tracking Number Formats Matter

When a customer enters a tracking number, your application needs to:

  1. Validate — Is this a real tracking number or a typo?
  2. Identify the carrier — Which carrier should we query?
  3. Route correctly — International numbers may need multiple carrier lookups

International Standard: S10 (UPU)

The Universal Postal Union (UPU) defines the S10 standard for international mail tracking:

Format: AALNNNNNNNNLAA
        ││         │││
        ││         ││└─ Country code (2 letters)
        ││         │└── Check digit (1 digit)
        ││         └─── Serial number (8 digits)
        │└───────────── Service indicator (1 letter)
        └────────────── Service type (1 letter)

Examples:

  • CP111222332US — USPS International Parcel
  • RR471012436GB — Royal Mail Tracked & Signed
  • RR987654326JP — Japan Post Registered Mail

Service types:

PrefixService
EA-EZEMS
RA-RZRegistered Mail
CA-CZParcels
LA-LZLetter Post

US Carriers

USPS

  • Formats vary by service:
    • Priority Mail: 22 digits (9400...)
    • Express Mail: 13 characters (S10 format)
    • Tracking: 20-22 digits

FedEx

  • Format: 12, 15, or 20 digits
  • Pattern: ^\d{12}$|^\d{15}$|^\d{20}$
  • Example: 123456789012

UPS

  • Format: Starts with 1Z, 18 characters total
  • Pattern: ^1Z[A-Z0-9]{16}$
  • Example: 1Z12345E0205271688

European Carriers

DHL

  • Format: 10 or 20 digits, may start with specific prefixes
  • Pattern: ^\d{10}$|^\d{20}$|^[A-Z]{3}\d{7}$
  • Example: 1234567890, JJD01234567890

Royal Mail (UK)

  • Format: S10 format with GB country code
  • Example: RR123456789GB

Japanese Carriers

Yamato Transport

  • Format: 12 digits, starts with specific prefixes
  • Pattern: ^\d{12}$
  • Example: 123456789012

Sagawa Express

  • Format: 12 digits
  • Pattern: ^\d{12}$
  • Example: 123456789012

Japan Post

  • Format: S10 for international, 11-13 digits for domestic
  • Example: RR123456789JP, 12345678901

Canadian Carriers

Canada Post

  • Format: 16 digits (domestic), or S10 with the CA country code (international)
  • Pattern: ^\d{16}$
  • Example: 7321315544001512, CP111222332CA

Canpar Express

  • Format: 1 letter + 18-25 digits
  • Pattern: ^[A-Z]\d{18,25}$
  • Example: D560000070000009044001

Carrier Detection with WhereParcel

Instead of implementing all these patterns yourself, ask WhereParcel. POST /v2/detect matches a number against the formats of every live carrier — free, with no carrier lookup and no usage — and you track it with the best match:

# 1. Find the carrier — free: format matching only, no lookup, no usage
curl -X POST https://api.whereparcel.com/v2/detect \
  -H "Authorization: Bearer YOUR_API_KEY:YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"trackingNumber": "1Z12345E0205271688"}'

# 2. Track it with the best match (here us.ups)
curl -X POST https://api.whereparcel.com/v2/track \
  -H "Authorization: Bearer YOUR_API_KEY:YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"trackingItems": [{"carrier": "us.ups", "trackingNumber": "1Z12345E0205271688"}]}'

/v2/detect returns every carrier whose format fits, each with a specificityScore:

{
  "success": true,
  "data": {
    "normalized": "1Z12345E0205271688",
    "candidates": [
      { "code": "us.ups", "name": "UPS (United Parcel Service)", "country": "US", "specificityScore": 67 },
      { "code": "intl.dhl", "name": "DHL Express", "country": "INTL", "specificityScore": 20 }
    ],
    "noMatch": false
  }
}

Pick the candidate with the highest specificityScore (the response above is abridged).

Validation Tips

  1. Strip whitespace and dashes — Customers often copy tracking numbers with extra formatting
  2. Normalize case — S10 numbers should be uppercase
  3. Check length first — Quick elimination before regex matching
  4. Use checksum validation — S10 numbers have a check digit you can verify
function cleanTrackingNumber(input) {
  return input
    .replace(/[\s\-\.]/g, '')  // Remove spaces, dashes, dots
    .toUpperCase()              // Normalize case
    .trim();
}

Summary

Understanding tracking number formats helps you build better tracking experiences. But instead of maintaining carrier-detection logic yourself, consider POST /v2/detect — it checks a number against the formats of all 39+ live carriers today (more on request) and is updated continuously.

For the full list of supported carriers and their formats, see our carriers page.

Or just paste a tracking number into our free Tracking Number Validator — it auto-detects the carrier from the format and shows the matching service type (no signup needed).

For a deep dive into the international S10 standard alone — including the exact check-digit formula and validation code — see UPU S10 Tracking Number Format Explained.

Can't find your carrier? We add new carriers on request — just let us know.

Request a carrier →

Got a question? Just ask. Drop by our Discord — the developer behind WhereParcel reads every message and replies personally. No bots, no tickets, just a real conversation.

Join Discord → Join Slack →

Tags: #tracking-numbers #carriers #formats #auto-detection