BLOG

How to Calculate Demurrage and Detention: A Practical Guide

In this blog, I cover what Demurrage & Detention charges actually are. Who needs to calculate them and why. How to calculate it manually, and what tools exist to make the process faster and more reliable.

What is Demurrage and Detention?

Demurrage and Detention Infographic

Demurrage and detention are separate charges, often confused because they’re usually billed together.

Firstly, Demurrage is charged by the carrier when a container sits at the port beyond its allotted free time. Demurrage charges accrue from when the container has arrived until it leaves the port / terminal.

Detention is charged once the container leaves the terminal, for the time it spends outside the port, (e.g. at a warehouse being unpacked) before it’s returned empty to the carrier. 

Some carriers offer a combined free-time allowance covering both, rather than separate clocks for each. 

Which model applies depends entirely on the carrier, the trade lane, and sometimes the specific contract. There is no single industry-wide standard.

Every carrier grants a free time period, typically somewhere between 3 and 10 days. During this period no charges apply. Once that free time expires, a per-day rate kicks in, and that rate is frequently tiered: the daily cost typically increases the longer the container is held, to encourage faster turnaround.

Who Needs to Calculate This, and Why

D&D calculation matters to a wider group of people than the phrase might suggest.

Freight forwarders are usually the ones doing the actual calculation. They need accurate figures to bill clients correctly and to ensure that carrier invoices are correct. Forwarders also advise clients proactively before charges accrue. Flagging a container that’s approaching its free-time deadline is far more valuable than discovering the charge after the fact.

Shippers and consignees (the cargo owners) need to understand Demurrage and Detention because they’re the ones ultimately paying it. Even without doing the calculation themselves, understanding how the charges work helps them plan pickups, query invoices they don’t understand, and minimize their cost exposure.

Finance and FP&A teams, particularly on the forwarder side, have a slightly different interest:  Knowing how much is currently accruing across open shipments matters for accurate forecasting. They also check for margin erosion due to under-recovered costs and client disputables.

How to Calculate D&D Manually

The core formula is straightforward, even if getting the inputs right often isn’t:

Chargeable days = Days container held − Free time
D&D charge = Chargeable days × Daily rate

Excel tip: the DAYS() function is the cleanest way to calcuate the “Days container held” figure without manually counting on your fingers.

The formula is =DAYS(end_date, start_date), and which two dates you use depends entirely on which charge you’re calculating:

Demurrage and Detention

The +1 matters: many carriers count the discharge (or gate-out) day itself as day one of the holding period, rather than starting the clock at zero. Leaving it off is a small, but easy mistake that quietly undercounts every calculation by one day. You should check this against your specific carrier’s tariff wording, since not all of them count inclusively. Note this only applies to the days-held calculation; free time itself is normally a flat number of days stated in the tariff, not something you derive from a date formula.

Calculation Pitfalls to Avoid

But three details typically make this harder in practice than the formula suggests.

1. Identifying the correct start and end dates. For demurrage, the clock usually starts from vessel discharge (or sometimes cargo availability, which can be a day or two later) and ends when the container is gated out of the terminal. For detention, the clock starts at gate-out and ends when the empty container is returned to the carrier’s nominated depot. Getting the wrong start date – a common error – throws off every day that follows.

2. Applying the correct free time. Free time isn’t universal, it varies by carrier, by port, by container type, and sometimes by specific contract terms negotiated for a particular client or trade lane. Using a generic “5 days free” assumption when the actual agreement grants 7 is a very common way to mis-charge a client.

3. Applying tiered rates correctly. When a carrier’s tariff is tiered – say, €50/day for days 1–5 of the chargeable period, then €75/day from day 6 onward – the calculation isn’t simply chargeable days × one flat rate. You calculate each tier separately, then sum the results.

4. Read the tariff carefully. Your carrier’s tariff might also change according to the content of the container (dangerous goods), the trade-lane (Asia imports), port holidays, and other variables. Check these carefully, otherwise your calculation will be incorrect.

These are some areas where manual spreadsheet calculations often go wrong, particularly under time pressure with many containers to process.

Worked example

A container is discharged on 1 July, gated out on 9 July, and the empty container is returned (gated in) on 17 July.

Demurrage (discharge → gate out):

  • Days held: =DAYS(9-Jul, 1-Jul)+1 = 9 days
  • Free time: = 3 days
  • Chargeable days: = 6 days (Days Held [9 days] – Free time [3 days])
  • Tariff: €47/day for days 1–5, €82/day from day 6
Days 1–5 (5 days) × €47 = €235
Day 6 (1 day)     × €82 = €82
Demurrage total         = €317

Detention (gate out → gate in):

  • Days held: =DAYS(17-Jul, 9-Jul)+1 = 9 days
  • Free time: = 3 days
  • Chargeable days: = 6 days (Days Held [9 days] – Free time [3 days])
  • Tariff: €19/day for days 1–3, €34/day from day 4
Days 1–3 (3 days) × €19 = €57
Days 4–6 (3 days) × €34 = €102
Detention total         = €159

Combined D&D on this one container = €476.

Notice both charge types can rack up meaningful totals independently, on the same container.

This is a simplified example. Real tariffs add further variables (container size, contract type, mode of transport from the terminal, etc), which is exactly where manual calculation becomes time-consuming and error-prone, especially at volume.

Tools that make life easier

For occasional, low-volume calculations, a well-built spreadsheet model with the tariff rules encoded can be a workable solution.

If you do a google search for ‘demurrage calculators’, what will you find? Lots of results for generic calculators! However, most are too simple to be of any help. Those that seem to have sufficient complexity to handle the tariff tiers don’t provide a breakdown of the calculations for validation. In any case, they require you to manually enter the carrier rates each time.

Many carriers also offer their own online Demurrage and Detention calculators on their customer portals. It’s useful as a quick sanity check against one carrier’s own tariff, but it only covers that carrier. That’s not much help once a forwarder juggles multiple carriers, ports, and contracts at once.

The practical challenges really show up at scale: dozens or hundreds of containers, multiple carriers with different tariff structures, multiple users and carrier tariffs that get updated periodically.

At this point, doing manual calculations is a genuine operational risk to your business. Getting the arithmetic right is an accuracy challenge. But deciphering which rate applies to which carrier, on which lane, with how many free days, becomes very easy to get wrong once volume increases.

Purpose-Built D&D Calculators

This is the gap purpose-built D&D calculation tools close. They encode each carrier’s actual tariff and free-time rules once, then apply them consistently. Proactive tracking flags containers approaching their free-time deadline before charges start accruing, not after.

If you’re currently managing demurrage and detention calculations the hard way, it’s worth taking a look at the YorkForte Ccean D&D Calculator. I built it specifically for this problem, and it works with any freight system rather than locking you into one particular platform.