Skip to main content

hts-lookup

Offline lookup and validation of US Harmonized Tariff Schedule (HTS) codes. The current schedule is bundled (about 0.5 MB compressed), so it works without network access or API keys. Pure Python, no dependencies.

pip install hts-lookup
import hts_lookup as hts

hts.TITLE                               # 'Revision 21 (2026)'
line = hts.lookup("6201.40.70")
line.description                        # 'Water resistant (634)'
line.general                            # '7.1%'
[c for c, _ in line.path]               # ['6201', '6201.40', '', '', '', '', '', '6201.40.70.00']

hts.lookup("6109.10.00.12").general     # '16.5%'  (10-digit lines inherit the 8-digit rate)
hts.lookup("6201.40").declarable        # False   (a subheading with lines under it)
hts.lookup("8471.30").code              # '8471.30.01.00' (only one line under it, so that line)

hts.is_valid("6201.40.99.99")           # False
hts.closest("6201409999").code          # '6201.40'

[l.code for l in hts.children("8507.60")]
hts.search("lithium ion", limit=5)

Command line:

$ hts-lookup 6201.40.70
$ hts-lookup --search "vinyl stickers"
$ hts-lookup --children 4202.92

Why validate codes

HS and HTS codes copied from supplier invoices, old spreadsheets or AI chat answers are often out of date or do not exist. is_valid() and closest() catch those before a shipment does.

Notes

  • general is the column 1 general (MFN) rate. Extra duties under Chapter 99 depend on the country of origin and are not applied.
  • The first six digits are the international HS code; digits 7 to 10 are US-specific.
  • The bundled schedule is updated with new USITC revisions; check hts_lookup.TITLE for the edition you have.

Step-by-step product guides, UK and EU rates, and the customs rulings behind each code: hs-code.net

Code: MIT. Data: public domain US government work, see DATA-LICENSE.md. Not affiliated with USITC or CBP.

Metadata

Release files for hts-lookup 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hts-lookup 0.1.0
File Size Uploaded Provenance Actions
hts_lookup-0.1.0.tar.gz 528.9 kB Without provenance Details for hts_lookup-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hts-lookup 0.1.0
File Interpreter ABI Platform Actions
hts_lookup-0.1.0-py3-none-any.whl Python 3 none any Details for hts_lookup-0.1.0-py3-none-any.whl

Total release size: 1.1 MB

Release files / hts_lookup-0.1.0.tar.gz

Download URL hts_lookup-0.1.0.tar.gz
Size 528.9 kB
Tags Source
SHA-256 checksum
How to use checksums
86e003e5acc92bc0dba7e372a8e123d7c28e69b466ff6a6c134cb4d899940dfa
BLAKE2b-256 checksum
How to use checksums
5e2ddaff9b1917bba919288a09119b71b407840d805eb717a589b3a0602363c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

Release files / hts_lookup-0.1.0-py3-none-any.whl

Download URL hts_lookup-0.1.0-py3-none-any.whl
Size 526.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61ed9a97639f3c0d3600ae167d10ad7f1b54017c4ffa397297718917b270cd9d
BLAKE2b-256 checksum
How to use checksums
39e3efa04aa3fe694cf9cf721b39908ce16c5a80391064534285b60d656eacb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

Security for hts-lookup 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page