GoRules Version 2 is here - redesigned, now with managed cloud.GoRules Version 2 is here!
Watch the launch videoWatchImport Duties Calculator
Automated system that calculates precise import duties and taxes based on product details, country relationships, and trade agreements.
Solution
This import duty calculator determines exact customs fees by analyzing multiple factors that affect international shipping costs. The system classifies products using both category information and Harmonized System codes to establish base duty rates specific to product types. It then applies country-specific rules that consider origin-destination relationships, existing free trade agreements, and current sanctions status.
The calculator handles preferential treatment eligibility, applying appropriate discounts when permitted by international trade agreements. Special handling for sanctioned countries automatically triggers additional fees and higher multipliers. The system ensures minimum duty thresholds are met while calculating the final duty amount and percentage rate relative to product value. This streamlines customs clearance processes while providing accurate, rules-compliant duty calculations for both businesses and customs brokers.
How it works
The calculator processes import information through several specialized components:
- Product Classification: Analyzes product category and HS code to determine the appropriate base duty rate and product classification.
- Country Rules Assessment: Evaluates the relationship between origin and destination countries, applying multipliers based on trade agreements and identifying sanctioned nations.
- Duty Calculation: Processes all collected data through a multi-step formula that:
- Calculates initial base duty from product value and classification rate
- Applies country-specific adjustments based on trade relationships
- Adds sanctions-related fees when applicable
- Applies preferential treatment discounts if eligible
- Ensures a minimum duty threshold is met
- Calculates the effective duty rate as a percentage of product value
Where teams use it
- E-commerce platforms calculating cross-border shipping fees
- Import/export businesses planning international shipments
- Customs brokers preparing documentation for clients
- Logistics companies providing shipping cost estimates
- Trade compliance departments verifying duty calculations
- Government agencies monitoring trade flows and revenue
Inside the decision model
Import Duties Calculator ships as a JDM decision graph with 4 nodes, 2 decision tables and 15 rules. Download it, load it into GoRules, and run it as-is on Zen Engine.
Request
inputA shipment is described by three objects: product with its category, value, weight, and hsCode; origin with the country plus the hasFTA and preferentialTreatment flags; and destination with the receiving country. Everything except weight is consumed by a downstream rule.
Sample requestJSON
{
"product": {
"category": "electronics",
"value": 1200,
"weight": 0.8,
"hsCode": "851712"
},
"origin": {
"country": "CN",
"hasFTA": false,
"preferentialTreatment": false
},
"destination": {
"country": "US"
}
}Product Classification
tableClassification pairs product.category with a Harmonized System prefix test under a first hit policy. 'electronics' splits on startsWith($, '85') for 'High-Tech Electronics' at a 0.15 baseRate versus '90' for 'Precision Electronics' at 0.12; 'textiles' distinguishes 'Clothing' (chapters 61, 62 at 0.20) from 'Home Textiles' (63 at 0.18); 'food' separates 'Perishable Food' (02, 03, 04 at 0.22) from 'Processed Food' (19, 20, 21 at 0.16); 'automotive' with prefix '87' takes the highest rate at 0.25; and the empty row defaults everything else to 'General Merchandise' at 0.18.
The chapter prefixes are the real HS nomenclature, 85 for electrical machinery, 61 and 62 for knitted and woven apparel, 87 for vehicles, so matching on the first two digits mirrors how customs schedules actually key rates to headings. The rate spread is also directionally faithful: real tariff schedules tax clothing and food more heavily than most electronics. The exact percentages are simplified single rates standing in for line-by-line tariff schedules.
| Product Categoryproduct.category | HS Codeproduct.hsCode | Base Duty Rateclassification.baseRate | Product Classificationclassification.category |
|---|---|---|---|
| 'electronics' | startsWith($, '85') | 0.15 | 'High-Tech Electronics' |
| 'electronics' | startsWith($, '90') | 0.12 | 'Precision Electronics' |
| 'textiles' | startsWith($, '61'), startsWith($, '62') | 0.20 | 'Clothing' |
| 'textiles' | startsWith($, '63') | 0.18 | 'Home Textiles' |
| 'food' | startsWith($, '02'), startsWith($, '03'), startsWith($, '04') | 0.22 | 'Perishable Food' |
| 'food' | startsWith($, '19'), startsWith($, '20'), startsWith($, '21') | 0.16 | 'Processed Food' |
+2 more rows in the downloadable template
Country Rules
tableTrade relationships turn into a multiplier on the classified rate, matched first-hit on origin.country, destination.country, and origin.hasFTA. 'MX' and 'CA' with hasFTA true get a countryMultiplier of 0.0, duty-free, while 'CN' to 'US' without an FTA is surcharged at 1.25, the European group 'GB', 'DE', 'FR', 'IT', 'ES' gets a mild 0.8 preference, 'VN' 0.9, and 'KP', 'IR' are the only rows setting hasSanctions true with a punitive 3.0 multiplier. The catch-all row applies a neutral 1.0 with no sanctions so unlisted origins still price normally.
Each row tracks a recognizable feature of US trade policy: duty-free Mexican and Canadian goods under a free trade agreement, elevated duties on Chinese imports, and North Korea and Iran as comprehensively sanctioned origins. Modeling all of that as one multiplier per lane is a simplification, but it keeps the geopolitical layer separate from product classification, which is how customs systems are typically structured.
| Origin Countryorigin.country | Destination Countrydestination.country | Has FTAorigin.hasFTA | Country MultipliercountryRules.multiplier | Has SanctionscountryRules.hasSanctions |
|---|---|---|---|---|
| 'CN' | 'US' | false | 1.25 | false |
| 'MX' | 'US' | true | 0.0 | false |
| 'CA' | 'US' | true | 0.0 | false |
| 'GB', 'DE', 'FR', 'IT', 'ES' | 'US' | false | 0.8 | false |
| 'KP', 'IR' | 'US' | - | 3.0 | true |
| 'VN' | 'US' | false | 0.9 | false |
+1 more row in the downloadable template
Duty Calculation
expressionSeven expressions assemble the final figure in order: baseDuty multiplies product.value by number(classification.baseRate), countryAdjustment applies the country multiplier, and additionalFees adds product.value * 0.1 only when countryRules.hasSanctions is true. preferentialDiscount then cuts the adjusted duty to 80 percent when origin.preferentialTreatment is set, and minDuty enforces a max([10, ...]) floor, but only when countryAdjustment > 0, so FTA lanes with a 0.0 multiplier stay genuinely duty-free instead of being bumped to the 10-dollar minimum. totalDuty and dutyRate finish the job, and with passThrough disabled the node returns just these computed keys as the response.
product.value * number(classification.baseRate)$.baseDuty * number(countryRules.multiplier)countryRules.hasSanctions == true ? product.value * 0.1 : 0origin.preferentialTreatment == true ? $.countryAdjustment * 0.8 : $.countryAdjustment$.countryAdjustment > 0 ? max([10, $.preferentialDiscount]) : 0$.minDuty + $.additionalFees$.totalDuty / product.valueOther Public Sector templates
View all templatesGovernment Assistance
Streamlined decision system that determines program eligibility based on income thresholds, household size, age factors, and special circumstances.
Public SectorTax Exemption
Automated system that assesses organizations for 501(c)(3) tax-exempt status based on structure, activities, and financial metrics.
Public SectorMunicipal Permit Evaluation System
Automated system that evaluates building and event permits based on zoning regulations, safety requirements, and environmental impact factors.
Make this template
your own.
Load Import Duties Calculator into GoRules, adjust the rules to your policy, and ship it behind your own API.