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.
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.
Prefer to talk it through? Book a call
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