Free tools / Logistics

Detention and demurrage calculator

Enter the container's event dates and the counting rules of your own contract: free days, whether the first day counts, calendar or working days, the public holidays it excludes, and the rate tiers. The calculator derives the days, shows each day and each tier, and exports the calculation as a CSV. It holds no carrier tariff: the rates and rules are yours.

How you enter the time
Enter
Move
Container events

Dates only, as they appear on the terminal and depot records. A timestamp late in the evening can belong to another day in the terminal's time zone: use the terminal's local date.

Weekends and public holidays

Where a rule below counts working days, it skips these weekend days and the holidays listed here.

No holiday calendar is built in: add the dates your contract or the terminal names.

No holiday entered.

Demurrage: the container at the terminal

0 if your contract gives none.

Rate tiers, from your tariff or contract

Day 1 is the first day past free time. Leave the last tier's end empty if it runs on.

Detention: the container outside the terminal

0 if your contract gives none.

Rate tiers, from your tariff or contract

Day 1 is the first day past free time. Leave the last tier's end empty if it runs on.

You checked one charge. Mirage checks every carrier invoice.

Every carrier invoice checked against the contracted rate and the shipment record before payment: detention, demurrage and accessorial overcharges caught. Send us a few invoices and we send back a plan, no commitment.

See freight invoice auditing

Document

We use your email to reply to you and, now and then, to tell you about Mirage. You can opt out at any time. Privacy policy

How the days are counted

Start and end events
Demurrage usually runs from availability (some contracts say discharge) until the full container leaves the terminal. Detention runs from gate-out full until the empty is returned on an import, from empty pickup until the full gate-in on an export. Your contract names the events.
The first day
Many contracts start free time the day after the start event; others count that day. Choose what yours says.
The last day
The day of gate-out or return is usually charged, but not always. The day-by-day table shows the effect of either choice.
Calendar or working days
Free time can be counted in working days while charged days run in calendar days, or both in the same unit. Weekends and the holidays you enter are skipped only where you choose working days.
Tiers
Rates often rise with time: one rate for the first days past free time, a higher one after. Each charged day is priced by the tier it falls in, and a day no tier covers is reported, not guessed.

Container detention, and the other detention

Here, demurrage is what the carrier or terminal charges while the container stays in the terminal past its free time, and detention (called per diem by many US carriers) is what the carrier charges while its equipment stays outside the terminal past its own free time. Both are counted in days.

In US trucking, detention means something else: the carrier bills for its driver and truck held at a shipper's or receiver's dock beyond the free time agreed, by the hour. This calculator does the ocean container case only.

For truck detention by the hour, see the carrier invoice audit calculator.

Checking the invoice against your count

On US trades, the Federal Maritime Commission's billing rule requires a detention or demurrage invoice from an ocean carrier, a marine terminal operator or an NVOCC to state the free time in days, the start and end dates of free time, the availability date for imports or the earliest return date for exports, the specific dates charged and the rates applied. The day-by-day table above gives you the same items, computed on your terms, to compare line by line.

A worked example

Illustrative example, invented figures. An import container is available on Thursday, October 1, 2026 and leaves the terminal full on Wednesday, October 14. The contract gives 4 free days counted in working days from the day after availability, charges calendar days after that, counts the gate-out day, and excludes Monday, October 12 as a public holiday. Tiers: days 1 to 5 at $100, day 6 onward at $150.

Free time: Friday October 2, then Monday 5, Tuesday 6 and Wednesday 7 (the weekend of October 3 and 4 is skipped). Charged: October 8 to 14, seven calendar days, the holiday included because charged days run in calendar days. Days 1 to 5 (October 8 to 12) at $100 make $500, days 6 and 7 (October 13 and 14) at $150 make $300: $800. Counted in calendar days throughout, the same dates give 9 charged days and $1,100.

FAQ

  • Demurrage is charged while the container stays in the terminal past its free time, before it is picked up. Detention is charged while the container is outside the terminal past its own free time: from pickup until the empty is returned on an import, from empty pickup until the full container is delivered back on an export. They often have separate free time and separate rates, which is why they are calculated separately here.

  • Only if you tell it to. Choose working days for free time, for charged days, or for both, pick which days are the weekend, and add the public holidays your contract excludes. No holiday calendar is built in, because which holidays count depends on the contract and the port.

  • It depends on the contract. Many count the day of the end event as a full day, some do not, and many start free time the day after the start event. Both choices are in the calculator, and the day-by-day table shows which days each one counts.

  • Free time and daily rates are set carrier by carrier, often lane by lane and contract by contract, and commonly rise in tiers. Your own tariff or service contract is the only reliable source; this calculator does the counting and the arithmetic once you have it.

  • Yes. A container can accrue demurrage while waiting at the terminal, then detention after it leaves full and before the empty is returned. With event dates, the gate-out date closes the first clock and opens the second.

  • No. It computes the charge your terms support, day by day, so you can compare it with the invoice. The dispute itself is between you and the billing party.

One container is a calculation. Hundreds a month are a process.

Mirage deploys AI agents that read carrier invoices and the terminal and depot records behind them, recompute detention and demurrage on your contracted terms, and flag the differences before payment, for your team to decide on.

See freight invoice audit automation