Detention and Demurrage Calculator

Detention and Demurrage Calculator

Emerging AI Skill PRO

Enter Calculation

Demurrage (container inside the terminal)

Detention (container outside the terminal)

Formula

Total Fee=N(Dd·Rd+Dt·Rt)where{N=ContainersDd=max⁡(0,Days in Terminal−Demurrage Free Days)Rd=Demurrage RateDt=max⁡(0,Days Out−Detention Free Days)Rt=Detention Rate\begin{gathered} \text{Total Fee} = N \left( D_{d} \cdot R_{d} + D_{t} \cdot R_{t} \right) \\[1.5em] \text{where}\quad \left\{ \begin{aligned} N &= \text{Containers} \\ D_{d} &= \max\left(0,\ \text{Days in Terminal} - \text{Demurrage Free Days}\right) \\ R_{d} &= \text{Demurrage Rate} \\ D_{t} &= \max\left(0,\ \text{Days Out} - \text{Detention Free Days}\right) \\ R_{t} &= \text{Detention Rate} \end{aligned} \right. \end{gathered}
Usage stats

Advertisement

Results

Total Detention and Demurrage Fees
$2,100.00
for all containers combined
Chargeable demurrage days 3
Demurrage fee $900.00
Chargeable detention days 6
Detention fee $1,200.00
Fee per container $1,050.00

Report an error on this page

What are detention and demurrage?

Demurrage is the charge a carrier or terminal applies when a loaded container stays inside the port or terminal longer than the free time allowed. Detention is the charge applied when the container has left the terminal but is not returned empty within its free time. Both are billed per container per day, and both can add up quickly on delayed shipments.

Timeline of a container from ship to port terminal to truck to empty return, with free time and charged periods marked
Demurrage accrues while the container sits in the terminal; detention accrues while it is out and not yet returned.

How to use this calculator

Enter the number of containers. For demurrage, enter the days the container sat in the terminal, the free days allowed, and the daily rate. For detention, enter the days between gate-out and empty return, the free days allowed, and the daily detention rate. The calculator returns chargeable days, each fee, the total, and the cost per container. Always check your carrier tariff for how free days and weekends are counted.

The formula explained

Each fee applies only to days beyond free time, so negative values are clamped to zero:

$$\text{Total} = N \times \left[\max(0, D_p - F_p) \times R_d + \max(0, D_o - F_o) \times R_t\right]$$

Here \(N\) = number of containers, \(D_p\) = days in terminal, \(F_p\) = demurrage free days, \(R_d\) = demurrage rate per day, \(D_o\) = days out, \(F_o\) = detention free days, and \(R_t\) = detention rate per day. This is a flat-rate model; tariffs with escalating tiers need to be calculated tier by tier.

Advertisement
Two day-count bars showing free days in green and chargeable days in color for terminal and out-of-terminal periods
Only days beyond the free time are charged, calculated separately for terminal and out-of-terminal periods.

Worked example

Two containers sit 8 days in the terminal with 5 free days at 150 per day, then stay out 10 days with 4 free days at 100 per day.

$$\text{Demurrage} = 2 \times (8 - 5) \times 150 = 900$$$$\text{Detention} = 2 \times (10 - 4) \times 100 = 1200$$$$\text{Total} = 900 + 1200 = 2100$$

That is 1,050 per container.

Cost Comparison Across Common Delay Scenarios

The table below uses clearly illustrative inputs, not real tariff rates. Actual rates, free days and day-counting rules vary by carrier, terminal, port and country, so always check your own tariff or contract. Assumptions: 4 containers, 5 demurrage free days in the terminal at $100 per container per day, and 4 detention free days out of the terminal at $80 per container per day. A flat rate applies, with no tiers.

Scenario Days in terminal / days out Chargeable demurrage days / detention days Demurrage (4 containers) Detention (4 containers) Total Cost per container
No delay (within free time) 5 / 4 0 / 0 $0 $0 $0 $0
2 days over on both 7 / 6 2 / 2 $800 $640 $1,440 $360
5 days over on both 10 / 9 5 / 5 $2,000 $1,600 $3,600 $900
10 days over on both 15 / 14 10 / 10 $4,000 $3,200 $7,200 $1,800

Worked check for the 5-day scenario: \(D_d = 10 - 5 = 5\) and \(D_t = 9 - 4 = 5\). Then \(4 \times (5 \times 100 + 5 \times 80) = 4 \times 900 = 3{,}600\). With a flat rate the cost grows linearly with each extra day. Real tariffs often escalate, so actual charges can climb faster.

Advertisement

Key Terms: Free Time, Per Diem, Gate-Out and Dwell

Term Definition Calculator input affected
Free time The period a container may stay in the terminal or outside it before charges begin. It is set separately for demurrage and for detention. Demurrage Free Days, Detention Free Days
Demurrage A charge for a loaded container that stays in the port or terminal beyond its free time. Days in Terminal, Demurrage Rate
Detention A charge for keeping a container outside the terminal (for example at your warehouse) beyond its free time, until it is returned. Days Out, Detention Rate
Per diem Latin for "per day". It is the daily rate per container, and the word is often used for detention in particular. Some carriers use it for any daily charge. Demurrage Rate, Detention Rate
Gate-in / gate-out Gate-out is when the container leaves the terminal, and it typically stops the demurrage clock and starts the detention clock. Gate-in is when it enters the terminal. Days in Terminal ends at gate-out. Days Out starts at gate-out.
Empty return Returning the emptied container to the carrier's designated depot or terminal. Detention normally stops at this point. Days Out
Dwell time The total time a container sits in the terminal, from discharge to gate-out. Long dwell is what drives demurrage. Days in Terminal
Calendar vs working days Calendar days count every day, including weekends and holidays. Working-day tariffs skip them. Check which your contract uses and enter the matching day count. All day inputs and free-day inputs
Tiered / escalating tariff A schedule where the daily rate rises after set periods (for example, a low rate for days 1-5 past free time, then a higher rate). This calculator applies one flat rate per fee type. For tiered tariffs, work out each tier separately and add the results. Demurrage Rate, Detention Rate (use one flat rate only)
Containers The number of units held under the same conditions. The per-container fee is multiplied by this count. Containers

This is general information. Terms, day-counting rules and rates differ between carriers, terminals and jurisdictions, so rely on your bill of lading, service contract and published tariff.

FAQ

Do free days include weekends?

It depends on the carrier. Some count calendar days, others count only working days, so enter the days exactly as your tariff counts them.

Can demurrage and detention overlap?

No. Demurrage runs while the container is inside the terminal and detention runs after it leaves, so they are billed for different periods.

How can I avoid these fees?

Pre-clear customs, schedule trucking before arrival, return empties promptly, and negotiate longer free time in your contract.

Last updated:

Most popular in Industry-Specific

View all Industry-Specific calculators