Commodity Origins

HS codes: how goods are classified for trade

Published 2026-09-05; updated 2026-09-06.

An HS code is the product number from the Harmonized System, the classification maintained by the World Customs Organization and used by more than 200 countries to identify goods crossing a border. It decides which tariff rate a shipment pays, which quotas and rules of origin apply to it, and which line of the national trade statistics it lands in.

That last function is why the code matters outside a customs hall. Every published figure for what a country exports rests on a decision about which code the goods were declared under, and different codes tell strikingly different stories about the same crop.

How does the six-digit structure work?

The system is a nesting of ever narrower categories, and each pair of digits adds one level.

The first two digits are the chapter, which covers a broad family: chapter 09 is coffee, tea, mate and spices; chapter 18 is cocoa and cocoa preparations; chapter 26 is ores, slag and ash. The next two make the heading, a specific product within that family: 0901 is coffee in all its forms, including husks and skins. The last two make the subheading, which distinguishes the states that product can be in: 090111 is coffee that is neither roasted nor decaffeinated, which is green beans, and 090121 is roasted coffee that has not been decaffeinated.

Those six digits are the international part, agreed under an international convention and identical in every member country. Beyond six, each country extends the code for its own tariff and statistical purposes, typically to eight or ten digits. That extension is not comparable across borders, so any cross-country comparison must be done at the six-digit level or coarser.

Three consequences follow for anyone reading trade data. First, the tariff attaches to the code, not to the substance, which gives exporters an incentive to present goods in the form that carries the lower rate and gives importing countries a lever to protect their own processing industries. Second, the code records the declaring country, not the origin of the crop or ore, so re-exports appear as exports from the intermediary. Third, the classification is revised roughly every five years, and codes that split or merge create breaks in long series; the trade figures on this site use the HS 2022 edition as compiled by CEPII BACI.

Trade values also carry a delivery basis. BACI reports both flows valued free on board, which is why world exports and world imports of the same code match, while raw customs data usually reports exports FOB and imports CIF, making reported world imports the larger number. The difference is set out in FOB, CIF and Incoterms.

The Harmonized System code tree from chapter 09 to green and roasted coffee A tree diagram. Chapter 09 covers coffee, tea, mate and spices. Heading 0901 covers coffee in all forms, with world exports of 50.6 billion dollars in 2024. It splits into subheading 090111, green coffee, worth 33.7 billion dollars at 4.36 dollars per kilogram and led by Brazil with 34.6 percent, and subheading 090121, roasted coffee, worth 15.0 billion dollars at 11.36 dollars per kilogram and led by Switzerland with 23.3 percent. A ruler along the bottom labels the digit pairs as chapter, heading, subheading and country-specific digits. Chapter 09 Coffee, tea, mate and spices Heading 0901: coffee, all forms $50.6 bn exported, 2024 090111 green coffee $33.7 bn exported, 7.72 bn kg Brazil 34.6%, Vietnam 11.6% 090121 roasted coffee $15.0 bn exported, 1.32 bn kg Switzerland 23.3%, Italy 16.7% average $4.36 per kg average $11.36 per kg 0 9 0 1 1 1 2 to 4 more digits chapter heading subheading country-specific Only the first six digits are the same in every country; trade values from CEPII BACI, 2024.

The same crop appears under two subheadings, and the choice of subheading changes both the size of the market and who leads it.

A worked example

Take coffee at three levels of the same branch, all for 2024 and all from CEPII BACI.

At the heading, HS 0901, world exports of coffee in all forms were $50.64 billion across 9.31 billion kilograms, declared by 195 exporters. Brazil led with $11.74 billion, or 23.2%, followed by Vietnam at $4.15 billion, or 8.2%. Switzerland came third at $3.75 billion, or 7.4%, and Germany fifth at $3.49 billion, or 6.9%. Neither Switzerland nor Germany grows coffee.

Drop to the subheading for green beans, HS 090111, and the picture changes. World exports were $33.68 billion across 7.72 billion kilograms from 176 exporters, and the ranking becomes a list of growers: Brazil $11.65 billion, or 34.6%; Vietnam $3.91 billion, or 11.6%; Colombia $3.44 billion, or 10.2%; Indonesia $1.63 billion, or 4.9%. World green coffee production was 11.1 million tonnes in 2024, with Brazil at 30.4% of it (FAOSTAT), so the trade ranking and the production ranking broadly agree.

Move sideways to roasted coffee, HS 090121, and the list inverts. World exports were $14.95 billion across 1.32 billion kilograms, led by Switzerland at $3.49 billion, or 23.3%, Italy at $2.50 billion, or 16.7%, and Germany at $2.09 billion, or 14.0%. These are the countries that roast, not the countries that grow.

The unit values explain why this matters. Dividing value by weight gives $4.36 per kilogram for green coffee and $11.36 per kilogram for roasted, in the same year. Roasting removes moisture and adds a brand, and the code boundary is where that value is captured. Which side of the boundary a country sits on is the subject of producing versus exporting versus processing, and the coffee commodity page carries both tables.

Cocoa runs the same arithmetic. In 2024 world exports of cocoa beans under HS 1801 were $18.87 billion, while the three processed codes together were larger: cocoa paste under 1803 at $8.28 billion, cocoa butter under 1804 at $13.60 billion and cocoa powder under 1805 at $4.85 billion (CEPII BACI). The cocoa page shows who leads each one.

What HS codes cannot tell you

They cannot tell you origin, only the declaring country, which is why re-export hubs appear as major exporters of goods they never grew. They cannot tell you grade: HS 090111 covers every arabica and robusta bean regardless of quality, so a code that is precise for customs is coarse for a market analyst who cares about the benchmark each lot prices against.

They cannot be compared past six digits, and they cannot be compared across revisions without checking the correspondence tables. And they measure declared value, not the price actually realized, since related-party transfers and long-term contracts both pass through customs at their contract value.

Frequently asked questions

What is an HS code?

An HS code is the product number from the Harmonized System, a classification maintained by the World Customs Organization and used by more than 200 countries. It identifies a good at customs, determines which tariff rate applies, and is the unit in which international trade statistics are compiled.

How many digits does an HS code have?

Six are international: two for the chapter, two more for the heading and two more for the subheading. Countries add their own digits beyond that, usually reaching eight or ten, so only the first six are comparable across borders.

What do the digits in an HS code mean?

In 090111, the 09 is the chapter for coffee, tea, mate and spices; 0901 is the heading for coffee in all its forms; and 090111 is the subheading for coffee that is neither roasted nor decaffeinated, meaning green beans.

Why does the choice of HS code change the ranking of exporters?

Because processing moves value between codes. In 2024 Brazil led green coffee exports under HS 090111 with 34.6% of a $33.7 billion market, while Switzerland led roasted coffee under HS 090121 with 23.3% of a $15.0 billion market (CEPII BACI).

How often does the Harmonized System change?

The World Customs Organization revises it roughly every five years, adding, merging and retiring subheadings. Because codes move between editions, a series that spans a revision can show a break that reflects reclassification rather than a change in trade.

Do HS codes show where a good was grown or mined?

No. They record the country that declared the shipment, so a re-export appears as an export from the intermediary. Switzerland exported $3.75 billion of coffee under HS 0901 in 2024 without growing any (CEPII BACI).

Commodities tracked here under more than one HS code (57)

Each of these needs two or more customs lines to describe the trade, often because the raw and processed forms are classified apart.

Related

Cite as: Commodity Origins, "HS codes: how goods are classified for trade", https://commodityorigins.com/learn/hs-codes/ (CC BY 4.0).