TL;DR
Demurrage is a charge for leaving cargo or containers at a port or terminal beyond the agreed free time. Detention is a charge for keeping the carrier’s equipment outside the terminal for too long. Both accrue per container per day and escalate quickly. The charges are genuinely difficult to validate because doing so requires reconciling the invoice against contracted free time, gate timestamps, and holiday calendars across several separate documents.
Key Takeaways: Demurrage applies to containers sitting inside the terminal past free time; detention applies to carrier equipment held outside it. Both are calculated from free time allowances and daily rates set in the carrier contract. Validating a charge means reconciling the invoice against the bill of lading, the contract terms, and gate in and out timestamps. Because that reconciliation is manual and dispute windows are short, invalid charges are frequently paid rather than challenged.
What is demurrage?
Demurrage is a charge levied by a carrier or terminal when cargo or containers remain at the port or terminal beyond an agreed period of free time. Once that free time expires, the charge begins accruing, typically per container per day, until the cargo is collected.
The purpose is to keep terminals moving. Port space is finite, and containers that sit occupy capacity the terminal needs for arriving cargo. Demurrage is the financial pressure that encourages importers to collect containers promptly.
The practical experience for an importer is different from the intent, though. Containers frequently sit for reasons outside the importer’s control: a customs hold, a chassis shortage, terminal congestion, an appointment system with no available slots, or a document problem upstream. The charge accrues regardless of cause, which is why demurrage is one of the most contested costs in international shipping.
What is detention, and how is it different?
Detention is the related but distinct charge for holding the carrier’s equipment, usually the container itself, outside the terminal for longer than the allowed free time. The clearest way to keep them apart:
- Demurrage is charged for time the container spends inside the terminal past free time, before you have picked it up.
- Detention is charged for time you keep the container outside the terminal past free time, after you have picked it up but before you have returned the empty.
So demurrage relates to cargo sitting at the port, and detention relates to equipment held at your facility or yard. A single shipment can incur both: demurrage while the container waited at the terminal, then detention because the empty was returned late. They are billed under different terms and often on different free time allowances, which is part of what makes reconciling them difficult.
A related term, per diem, is often used interchangeably with detention, particularly in North American inland and rail contexts.
How the charges are calculated
The calculation looks simple and is rarely simple in practice. Three inputs drive it:
- Free time. The number of days allowed before charges begin, set in the carrier contract or service agreement. Free time differs by carrier, by trade lane, by contract, and sometimes by container type, and demurrage and detention often carry different allowances.
- The daily rate. The per container, per day charge once free time expires. Rates commonly escalate in tiers, so days 1 to 5 past free time cost less per day than days 6 to 10, and so on. This tiering is why charges grow disproportionately on containers that sit for extended periods.
- The clock. When the count starts and stops, which depends on events like vessel discharge, gate out, and empty return, recorded as timestamps by the terminal and carrier.
Whether free days are counted as calendar days or working days, and how weekends and public holidays are treated, varies by contract and by port. Those details materially change the total, and they are exactly the details that get overlooked when an invoice is reviewed quickly.
Why the charges are so hard to validate
Here is the core operational problem. A demurrage or detention invoice arrives stating an amount owed. Determining whether that amount is correct requires assembling information that lives in several different places, produced by different parties:
- The invoice itself, stating the charge, the container numbers, and the days claimed.
- The carrier contract or service agreement, which defines the free time allowance and the rate tiers that should have been applied.
- The bill of lading and shipment documents, establishing the shipment particulars and dates.
- Terminal and carrier timestamps, the gate in, gate out, discharge, and empty return events that determine when the clock actually started and stopped.
- The applicable calendar, to determine which days were working days at that port and which were holidays or non working days under the contract.
Validating one charge means reconciling all of these against each other and checking whether the days claimed match the days actually chargeable under the contract. That is a multi document reconciliation, and it has to happen for every container on every invoice. Structurally it is the same shape as the two-way, three-way, and four-way matching problem in accounts payable, except the documents are freight documents and the disputed figure is a per day accrual rather than a line item price.
Common discrepancies include the clock starting before it should have, free time applied at the wrong allowance, rate tiers applied incorrectly, charges continuing through days when the container was under a customs hold or the terminal was closed, and the same period billed as both demurrage and detention.
Why invalid charges get paid anyway
Even when teams suspect a charge is wrong, several pressures push toward paying it:
- Dispute windows are short. Carriers set deadlines for challenging charges, and the window often closes before a busy team has assembled the evidence.
- Cargo is held hostage to payment. Containers may not be released until charges are settled, so paying is the fastest way to get freight moving, and disputing afterwards is harder than disputing before.
- The evidence takes real effort to assemble. Building a credible dispute means producing the timestamps, the contract clause, and the calculation showing what should have been charged. That is hours of work per claim.
- Individual charges look small relative to the effort. A few hundred dollars on one container rarely justifies the investigation, so it gets absorbed. Across a year and thousands of containers, the absorbed total is substantial.
The result is a predictable pattern: invalid charges are quietly paid because validating and disputing them costs more attention than the individual charge appears to be worth.
Where automation fits
Because the difficulty is reconciliation rather than judgment about shipping, this is a strong candidate for automation, and specifically for automation that can read documents and reason about them rather than follow fixed rules.
The work involved is reading a demurrage or detention invoice in whatever format the carrier sends it, extracting the containers and days claimed, pulling the relevant free time and rate terms from the applicable contract, comparing them against the gate and discharge timestamps for those containers, applying the correct working day treatment, and identifying where the claimed amount differs from the amount actually chargeable. Where a discrepancy exists, the same process can assemble the supporting evidence into a dispute package.
The reason this resisted automation is that none of these inputs arrive in a consistent structure. Carrier invoices differ by carrier. Contract terms are written in prose across varied agreements. Timestamps come from terminal systems and portals in different formats. Extracting fields from a fixed template does not work when there is no fixed template, and the important part is the comparison and the reasoning about which days were actually chargeable. This is the same obstacle that makes logistics document processing resist conventional automation.
Because these are financial charges that get disputed with carriers and reviewed in audits, the validation has to be defensible. When a charge is challenged, the case rests on showing precisely which contract clause applied, which timestamps were used, and how the correct figure was derived. A system that flags a charge as questionable without an inspectable basis does not produce a dispute you can win.
This is the frame Kognitos works on, and the boundary matters. Kognitos is not a transportation management system, a freight forwarder, or a carrier portal, those systems move freight and hold the operational data. Kognitos is the reasoning and exception layer that works alongside them and your ERP and logistics systems: reading demurrage and detention invoices, contracts, and timestamp records in whatever formats they arrive, reconciling them against each other, identifying charges that do not match the contracted terms, and assembling the evidence for disputes, using deterministic, English as code logic so every check and finding is explainable and produces a complete audit trail. The carrier bills; Kognitos determines whether the bill is right, and shows the working.
Getting started
The useful first question is not how much demurrage you paid last year but what share of it was ever validated against contract terms before payment. For most importers the honest answer is very little, because validation was never practical at volume. Sampling a month of charges and reconciling them properly against free time, rate tiers, and gate timestamps usually reveals both a recovery opportunity and a recurring pattern worth fixing upstream.
For related logistics and document processes, see our guides on logistics automation, why conversational exception handling solves logistics document processing, and two-way vs three-way vs four-way matching. To see how deterministic AI validates freight charges and builds dispute evidence, book a demo or try the platform.
