6 min read

Harbor Maintenance Fee and Merchandise Processing Fee: How to Model CBP Fees in Landed Cost

A container ship docked at a port with cranes and a small stack of coins on the quay
Duty gets the attention, but port and processing fees end up on the same entry summary.

Who is affected and why it matters

Anyone who calculates what an import really costs runs into two CBP fees sooner or later: the merchandise processing fee (MPF) and the harbor maintenance fee (HMF). If you are a developer building a landed-cost estimate, a quote tool, or a margin dashboard, leaving them out makes every number a little too low. On high-value ocean shipments, “a little” can add up to real money.

Importers and customs brokers know these fees from the entry summary. The aim here is to explain them well enough that the code matches what shows up on the bill.

The two fees at a glance

  Merchandise processing fee (MPF) Harbor maintenance fee (HMF) Regulation 19 CFR 24.23 19 CFR 24.24 What it pays for CBP’s cost of processing commercial entries Maintenance of US ports and harbors Applies to Most formal and informal commercial entries, any transport mode Commercial cargo loaded or unloaded from vessels at covered US ports Basis Ad valorem on entered value, with a minimum and maximum per formal entry Ad valorem on the value of the cargo Limits Min and max are adjusted every fiscal year No per-entry cap

The percentages below come from the regulation text, not from a tariff schedule, and they are what the eCFR showed when this was written. Always read the current text before hard-coding anything.

Merchandise processing fee (MPF)

How MPF is calculated

For formal entries, 19 CFR 24.23 sets the MPF as an ad valorem percentage of the value of the merchandise. It is a percentage of entered value, with a minimum and a maximum per entry. CBP publishes the current figures in its User Fee Table. CBP adjusts the minimum and maximum for inflation each fiscal year, which starts October 1. Don’t copy last year’s limits from a blog post. Read them from the eCFR, and store them as configuration with an effective date.

Informal entries carry a separate MPF structure set by the same section, which varies with how the entry is prepared. Treat informal and formal entries as different fee schedules in your model.

What MPF is based on

MPF is based on the value of the goods as entered, so it follows the customs value used for duty. If your system already computes customs value correctly (generally transaction value, without international freight and insurance), use that same number here.

Common MPF exceptions

Some goods are exempt from or reduced for MPF, including certain originating goods under free trade agreements. A USMCA-qualifying entry, for example, may be exempt. Model exemptions as rules that your classification and origin data feed into. Don’t hand-edit totals.

Harbor maintenance fee (HMF)

How HMF is calculated

Under 19 CFR 24.24, the HMF is an ad valorem charge on the value of commercial cargo loaded on or unloaded from a commercial vessel at a covered port. It is a percentage of the cargo’s value (see CBP’s User Fee Table for the current figure). Unlike MPF, it has no per-entry maximum, so it grows in step with shipment value.

When HMF applies

This is the most common bug in fee code: HMF is a vessel fee. Cargo that arrives by air, truck, or rail does not pay HMF. Some vessel cargo is exempt as well, including shipments eligible for informal entry, intraport movements, and cargo moving in bond for export, so check 19 CFR 24.24 for edge cases. Note that admission into a foreign-trade zone does not avoid HMF.

In code, the transport mode decides whether HMF applies at all:

hmf = shipment.mode == :ocean && covered_port?(shipment.port_of_unlading) ?
        entered_value * HMF_RATE : 0
A cargo ship, a cargo plane and a freight truck side by side, each with a small coin pile
Only ocean cargo pays HMF. MPF applies to formal commercial entries in every mode; most mail shipments are exempt.

Putting fees and duty together in code

A complete landed-cost estimate has a few separate layers:

  1. Duty from the HTS code and origin, including any Chapter 99 additional duties such as Section 301.
  2. CBP fees: MPF, plus HMF for ocean cargo.
  3. Other costs: freight, insurance, brokerage, and any AD/CVD deposits.

The Tariffs API resolve endpoint handles the first layer. It does not compute MPF or HMF, so you add those yourself:

curl -s "https://tariffsapi.com/api/v1/tariffs/resolve?hts=9403.60.80&origin=CN&resolve_chapter_99=true" \
  -H "Authorization: Bearer $TARIFFS_API_KEY"
import os, requests

def landed_duty_and_fees(hts, origin, entered_value, mode, fee_cfg):
    r = requests.get(
        "https://tariffsapi.com/api/v1/tariffs/resolve",
        params={"hts": hts, "origin": origin, "resolve_chapter_99": "true"},
        headers={"Authorization": f"Bearer {os.environ['TARIFFS_API_KEY']}"},
        timeout=10,
    )
    r.raise_for_status()
    body = r.json()

    rate = body["summary"]["total_resolved_ad_valorem_rate"]  # percent or None
    duty = entered_value * rate / 100 if rate is not None else None

    # fee_cfg is loaded from your own config, keyed by fiscal year
    mpf = min(max(entered_value * fee_cfg["mpf_rate"], fee_cfg["mpf_min"]), fee_cfg["mpf_max"])
    hmf = entered_value * fee_cfg["hmf_rate"] if mode == "ocean" else 0

    return {
        "duty": duty,
        "duty_declined_reason": body["summary"].get("total_declined_reason"),
        "mpf": mpf,
        "hmf": hmf,
        "hts_revision": body["data_source"]["hts_revision"],
        "request_id": body["request_id"],
    }

A few notes on that snippet:

  • MPF min and max are applied per entry, not per line. If one entry covers many SKUs, add up the entered value first and apply the limits once.
  • When total_resolved_ad_valorem_rate is null, the API is declining to state a single number, and summary.total_declined_reason says why. The eight-digit code in the example above is one such case: the ten-digit lines under it carry different measures, so the reason comes back as scope_varies_by_statistical_suffix. Send the full ten-digit code where you have it, pass the reason through to your UI, and never treat the null as zero.
  • Keep fee settings in config with effective dates, so the October 1 update is a data change and not a deploy.
An open customs entry folder with blank form fields, a magnifying glass and a calculator
Fees are calculated per entry, so group lines the way your broker files them.

Checklist for accurate fee modeling

  • Is HMF limited to ocean shipments at covered ports?
  • Are MPF minimum and maximum applied once per formal entry?
  • Do fee settings update each fiscal year?
  • Are FTA exemptions driven by origin data, not by hand?
  • Are fees shown separately from duty, so a customer or finance team can audit them?

To check a single product quickly, the tariff calculator shows the resolved duty for any HTS code and origin, for example 8471.30.01.00 for laptops.

FAQ

What is the harbor maintenance fee?

The harbor maintenance fee is a CBP-collected charge on the value of commercial cargo loaded or unloaded from vessels at covered US ports. It is set by 19 CFR 24.24 as a percentage of cargo value and funds port and harbor maintenance.

Does the harbor maintenance fee apply to air freight?

No. HMF applies to cargo moved by commercial vessel. Air, truck, and rail shipments do not pay it, although they generally still pay the merchandise processing fee.

What is the merchandise processing fee (MPF)?

MPF is a CBP user fee on commercial entries, set by 19 CFR 24.23. For formal entries it is an ad valorem percentage of the merchandise value, with a minimum and maximum that CBP adjusts each fiscal year.

Are MPF limits the same every year?

No. The minimum and maximum MPF for formal entries are adjusted for inflation each fiscal year, starting October 1. Check the current eCFR text or CBP’s user fee guidance before using them.

Do USMCA goods pay MPF?

Originating goods under certain free trade agreements, including USMCA, can be exempt from MPF. The exemption depends on the goods actually qualifying under the agreement’s rules of origin and the claim being made properly.

Does Tariffs API calculate MPF and HMF?

No. The API resolves duty rates by HTS code and origin, including Chapter 99 additional duties. CBP fees like MPF and HMF should be calculated in your own code using the current regulation values, as shown above.


Need duty rates you can trust next to your fee logic? See pricing or browse the API documentation.

This article is general information, not legal or customs advice. Fee rules have exceptions; confirm specifics with the linked regulations or a licensed customs broker.

Explore the data

Related news