---
title: "What Is COGS (Cost of Goods Sold)? Formula and Example | SKU.io"
url: "https://www.sku.io/glossary/cogs/"
description: "COGS is what the products you sold cost you, including freight and duty. The formula, a worked example, and why a flat COGS percentage hides losing products."
published: 2026-11-20
updated: 2026-11-21
---

Ecommerce operations glossary

# What is COGS (Cost of Goods Sold)?

Also called Cost of goods sold, Cost of sales

COGS, or cost of goods sold, is what the products you sold in a period cost you: their purchase price plus the freight, duty and other costs of getting them ready to sell. It is subtracted from revenue to get gross profit, and it counts only units that sold, not stock still on the shelf.

## Worked example

The periodic formula works from three numbers your books already have:

COGS = opening inventory + purchases − closing inventory

|     | Amount |
| --- | --- |
| Opening inventory | $40,000 |
| Purchases, at landed cost | $65,000 |
| Closing inventory | $45,000 |
| **COGS** | **$60,000** |

With $150,000 of revenue, gross profit is $150,000 − $60,000 = $90,000, a 60% gross margin.

## Periodic and per order

The formula above gives one number for the period and depends on an accurate closing count. Recording cost on each order as it ships gives the same total over time, plus the cost of every order and product, so you can see which products earn their margin and which do not.

## What goes in it

Purchase price, inbound freight, duty, brokerage and other costs of bringing stock in belong in COGS once the units sell. Outbound shipping to customers, marketplace fees and ad spend are costs of selling, and most businesses report them below gross profit. Whichever lines you choose, keep them the same every month so margins compare.

## Questions

### How do I post cost of goods sold to Xero from my inventory system?

Post COGS from the unit costs of what actually shipped, not as a flat percentage of sales. Most brands post it as journals by day or by period, matched to the sales they belong to, with inventory reduced by the same amount. SKU.io records COGS on each shipment as it is fulfilled, by taking the oldest FIFO cost layers for the units that left the warehouse, and keeps that in its own ledger, which it syncs to Xero or QuickBooks Online.

### Why not post COGS as a percentage of sales?

Because a flat percentage hides the products that lose money and drifts from your real inventory value every month. When costs change between shipments, the percentage is wrong for some products in both directions, and the books stop matching the stock.

## In SKU.io

SKU.io records COGS on each shipment as it is fulfilled, by taking the oldest FIFO cost layers for the units that left the warehouse.

[How it works, in the SKU.io docs](https://www.sku.io/docs/guides/orders/sales-orders/ship/how-fulfilling-moves-inventory-and-cogs/)

## Read next

-   [Free COGS formula calculator](https://www.sku.io/tools/cogs-formula-calculator/)
-   [How a flat COGS percentage hides losing SKUs](https://www.sku.io/flat-cogs-percentage-hides-losing-skus/)
-   [What to post to QuickBooks Online](https://www.sku.io/what-to-post-to-quickbooks-online/)
-   [Ecommerce accounting standards](https://www.sku.io/ecommerce-accounting-standards/)
-   [Inventory accounting in SKU.io](https://www.sku.io/accounting/)
-   [Gross margin from COGS](https://www.sku.io/glossary/gross-margin/)

## More terms: Accounting

-   [Carrying cost](https://www.sku.io/glossary/carrying-cost/)
-   [Chart of accounts](https://www.sku.io/glossary/chart-of-accounts/)
-   [Clearing account](https://www.sku.io/glossary/clearing-account/)
-   [Contribution margin](https://www.sku.io/glossary/contribution-margin/)
-   [ERP](https://www.sku.io/glossary/erp/)
-   [FIFO](https://www.sku.io/glossary/fifo/)
-   [Gross margin](https://www.sku.io/glossary/gross-margin/)
-   [Inventory reconciliation](https://www.sku.io/glossary/inventory-reconciliation/)
-   [Inventory valuation](https://www.sku.io/glossary/inventory-valuation/)
-   [Inventory write-down](https://www.sku.io/glossary/inventory-write-down/)
-   [LIFO](https://www.sku.io/glossary/lifo/)
-   [Month-end close](https://www.sku.io/glossary/month-end-close/)
-   [Perpetual inventory](https://www.sku.io/glossary/perpetual-inventory/)
-   [Three-way match](https://www.sku.io/glossary/three-way-match/)
-   [Weighted average cost](https://www.sku.io/glossary/weighted-average-cost/)

Updated November 21, 2026 · [All terms](https://www.sku.io/glossary/)
