← All articles

Cost of goods sold (COGS): the formula, and what goes in it

COGS = opening inventory + purchases − closing inventory. How to work it out, what goes in it for an importer — landed cost included — and what stays out.

Cost of goods sold (COGS) is the direct cost of the goods a business sold during a period. It is worked out as opening inventory + purchases − closing inventory. For an importer, "purchases" means the landed cost of the goods: the supplier's price plus the freight, insurance, duties and clearance it took to get them into stock.

In short:

Cover: cost of goods sold — opening stock plus purchases minus closing stock

The COGS formula, with an example

Amount
Opening inventory (start of the period)50,000
+ Purchases in the period, with landed costs200,000
− Closing inventory (end of the period)70,000
= Cost of goods sold180,000

If sales in the period were 300,000, gross profit is 300,000 − 180,000 = 120,000, a gross margin of 40%.

How COGS is worked out, with example figures: 50,000 + 200,000 − 70,000 = 180,000

What goes into COGS

For a manufacturer, COGS includes:

The split varies widely by industry; in a typical example, direct materials might be 60% of COGS, overheads 20%, labour 10% and inbound freight 5%.

For importers: landed cost belongs in the stock value

Under IAS 2, the international accounting standard for inventories, the cost of purchased goods includes the purchase price, import duties and other non-recoverable taxes, transport, handling and other costs directly needed to bring the goods to their present location and condition. For an importer, that usually means:

Landed cost in the stock value: purchase price, freight and insurance, duties and clearance

What stays out of COGS

Demurrage and detention are usually treated as expenses as they happen, not added to the stock value. Either way they come straight off your margin, for nothing in return. Check how your own accounting policy treats them. Our guide to demurrage and detention explains how they start.

Why logistics teams should care about COGS

Freight rates, port charges and clearance fees all land in COGS, so logistics decisions show up directly in gross margin. A lower freight rate that comes with fewer free days can cost more in the end.

Questions

What is the formula for COGS?

COGS = opening inventory + purchases during the period − closing inventory.

Is freight included in COGS?

Inbound freight — bringing goods into your stock — is normally part of inventory cost and so of COGS. Outbound freight to customers is usually a selling or distribution cost.

Is demurrage part of COGS?

Usually not. Demurrage and detention are generally treated as expenses when incurred, because they are avoidable rather than part of the normal cost of the goods.

In SailPing: add a container's last free day — or it comes from the shipping line, when the line sends one — and it is counted down on your dashboard, so you see demurrage coming.