DEV Community

Cover image for How HS Codes Work: A Structured Breakdown for Developers and Trade Teams
John Hall
John Hall

Posted on

How HS Codes Work: A Structured Breakdown for Developers and Trade Teams

If you are building anything that touches customs data, product classification, or cross-border trade, you will deal with HS codes. Here is what you actually need to know about their structure.

The Data Structure

An HS code is a hierarchical numeric identifier built in three nested pairs: Chapter XX, Heading XX, and Sub-heading XX. For example, 84 81 40 forms the full code 848140, which refers to a specific type of industrial tap or cock.
This hierarchy maps directly to a tree structure:

  • 97 top-level chapters
  • ~1,244 headings
  • ~5,244 sub-headings at the international level

National Extensions

National extensions to HS codes vary by region but generally expand the six-digit base for local use. In the UK, codes typically extend to 10 digits under the Commodity Code system. The EU also uses a 10-digit structure through the Combined Nomenclature (CN Code). In China, classification is similarly extended under its national tariff coding system, while the US uses the Harmonised Tariff Schedule (HTS) to add additional digits for detailed duty and regulatory purposes.
You can explore How to read an HS Code in depth for better understanding.

Classification Logic

The WCO defines six General Rules of Interpretation. In short:

  1. Read the section and chapter notes first
  2. Use the most specific description available
  3. Apply essential character rules for mixtures
  4. Fall back to the code that appears last if two codes are equally valid For automated classification, rule 1 and rule 2 handle the majority of cases. Rules 3 through 6 are edge cases but matter for complex goods.

API and Integration Considerations

When integrating with customs platforms or tariff APIs:

Always validate codes against the current tariff schedule (updated annually in January)
The UK Global Tariff, EU TARIC, and US HTS are the primary authoritative sources
Six-digit codes are stable across most updates; national extensions change more frequently

If you want to see how AI-assisted classification handles this at scale, Watch a demo of iCustoms.

Top comments (0)