What cost of goods sold actually measures
Cost of goods sold is the cost of inventory that left the business this period, not the cost of inventory you bought this period. Those two numbers are almost never equal, and confusing them is the most common error on a small-business income statement.
Inventory is an asset. When you buy or build a unit, its cost sits on the balance sheet and nothing hits the income statement. The moment the unit sells, that cost moves out of inventory and becomes an expense. The cost of the thing and the revenue from the thing land in the same period, which is the matching principle in its purest form.
Because inventory acts as a reservoir, the arithmetic is a flow calculation: whatever came in, minus whatever is still there, must have gone out. Hence the identity every accountant reaches for. Notice what carries the weight in it — ending inventory. Under a periodic system COGS is never measured directly; it is a residual computed from a physical count, so every ounce of counting error lands squarely in profit.
COGS drives three decisions. It sets gross profit, the money available to cover every other cost you have. It sets taxable income, because the IRS makes producers and resellers capitalise inventory cost and deduct it only as goods are sold. And it feeds the ratios lenders read: gross margin, inventory turnover and days inventory outstanding.
The formula explained, line by line
Start with the reseller version. Beginning inventory is not an estimate — it is last period's ending inventory, unchanged. If the two disagree you have a cut-off error, and every ratio downstream is wrong.
Net purchases is where the judgement sits. Invoice price is only the starting point. You add freight-in, because a cost incurred to bring goods to their present location and condition is inventory cost under both ASC 330 and IAS 2. You subtract purchase returns and allowances for goods sent back or concessions received, and purchase discounts you actually took, such as the 2% on a 2/10 net 30 invoice. What you do not subtract is freight-out: shipping to the customer is a selling cost that belongs below the gross profit line.
A manufacturer adds a second stage, because goods are created rather than bought. Three pools flow into production: direct materials used (beginning raw materials plus raw material purchases minus ending raw materials), direct labor for the people who physically transform the product, and manufacturing overhead applied — indirect factory cost charged to jobs through a predetermined overhead rate. Those three sum to total manufacturing cost.
But not everything you started got finished. Adding beginning work in process and subtracting ending work in process converts total manufacturing cost into cost of goods manufactured — the cost of units that crossed the finish line. COGM then behaves exactly as purchases do for a reseller: an addition to finished goods, run through the same beginning-plus-additions-minus-ending logic.
The structure is deliberately independent of your cost-flow assumption. Valuing the closing count with FIFO, LIFO or weighted average cost changes the number you plug in for ending inventory. It does not change the equation.
Worked example: a wholesaler's year in five lines
A plumbing-supply wholesaler closes its year with these books: opening inventory $42,000; gross purchases $310,000; inbound freight $8,500; goods returned to vendors $6,200; early-payment discounts taken $4,300; the December count values remaining stock at $38,500. Net sales were $520,000.
- Net purchases. $310,000 + $8,500 = $318,500 of gross cost delivered. Subtract $6,200 of returns and $4,300 of discounts: $318,500 − $10,500 = $308,000.
- Cost of goods available for sale. $42,000 opening stock + $308,000 net purchases = $350,000. This is the total cost the business had available to sell during the year.
- Subtract what is left. $350,000 − $38,500 = $311,500 cost of goods sold.
- Gross profit. $520,000 − $311,500 = $208,500.
- Gross margin. $208,500 ÷ $520,000 = 0.40096, or 40.1%.
Now feel the leverage in step 3. Suppose the count missed one pallet worth $6,000, so ending inventory is recorded at $32,500. COGS rises to $317,500 and gross profit falls to $202,500 — a 2.9% hit to reported profit from a $6,000 miscount, which is only 1.7% of the $350,000 of goods available for sale. And it does not stop there: understated ending inventory becomes understated beginning inventory next year, overstating next year's profit by the same $6,000. Inventory errors are always two-period errors.
Run the same business as a manufacturer. Opening finished goods $25,000; direct materials used $120,000; direct labor $90,000; overhead applied $60,000; opening WIP $15,000; closing WIP $12,000; closing finished goods $30,000. Total manufacturing cost is $270,000. COGM is $270,000 + $15,000 − $12,000 = $273,000. COGS is $25,000 + $273,000 − $30,000 = $268,000. Two inventory accounts, two applications of one identity.
How to read the result
Read COGS through gross margin, and read gross margin against your own history first. A single period's margin tells you almost nothing; four steady quarters and then a two-point drop tells you a great deal. Compare against outside benchmarks only within a tight industry definition, because two competitors can report different margins purely because one puts inbound freight and warehouse labour in COGS and the other does not.
Three diagnostics are worth running every close. Margin versus mix: if margin falls while product mix is unchanged, the cause is pricing or purchase cost. COGS versus purchases: if COGS rose faster than purchases you liquidated inventory, and if it rose slower you built stock — neither is inherently bad, but both move cash, which is why this number appears in cash conversion cycle work. Margin versus turnover: a low margin with fast turnover is a viable model, a low margin with slow turnover usually is not.
Watch for spurious margin improvement. A manufacturer that builds more units than it sells pushes fixed overhead into ending inventory instead of COGS, lifting reported gross profit without a single extra sale. Under absorption costing that is entirely legal and entirely misleading, which is why analysts compare production volume to sales volume before trusting a margin trend.
Same purchases, three cost-flow assumptions
| Method | Ending inventory | Cost of goods sold | Gross profit | Gross margin |
|---|---|---|---|---|
| FIFO | $2,100 | $3,400 | $2,600 | 43.3% |
| Weighted average | $1,833 | $3,667 | $2,333 | 38.9% |
| LIFO | $1,600 | $3,900 | $2,100 | 35.0% |
Identical physical facts, three legal answers, a $500 spread in reported profit. FIFO assigns the oldest $3,400 to COGS; LIFO assigns the newest $3,900; weighted average uses $5,500 ÷ 450 = $12.22 per unit. LIFO is permitted under US GAAP but prohibited by IAS 2.
Which rules govern this number
US GAAP: FASB ASC 330, Inventory, measures inventory at cost — the expenditures and charges incurred to bring an article to its present condition and location. Inventory not measured under LIFO or the retail method is then carried at the lower of cost or net realisable value.
IFRS: IAS 2, Inventories, requires cost to include purchase cost, conversion cost and other costs of bringing inventory to its present location and condition, measured with FIFO or weighted average cost. LIFO is not permitted.
US tax: IRC §471 requires inventories where they are needed to clearly determine income, and §263A forces producers and many resellers to capitalise indirect costs that book accounting might expense. Small businesses meeting the §448(c) average-gross-receipts test are exempt from §263A; that threshold is indexed for inflation, so check the current figure in IRS Publication 538.
Mistakes that corrupt a COGS figure
- Using purchases as COGS. Legitimate only when beginning and ending inventory are equal, which for a real business means never. Enter both balances.
- Leaving freight-in out. Inbound freight is inventory cost under ASC 330, IAS 2 and §263A. Expensing it understates inventory and overstates COGS in the year of purchase.
- Putting freight-out in COGS. Shipping to customers is a distribution cost. Some companies do present it inside cost of revenue, but then they should say so, because it moves the margin.
- Counting consignment goods. Stock held on consignment belongs to the consignor; counting it inflates ending inventory and understates COGS.
- Missing goods in transit. FOB shipping point means title passed at the vendor's dock, so it is yours and must be counted even though it is on a truck. FOB destination means it is not.
- Skipping the lower-of-cost-or-net-realisable-value write-down. Obsolete stock carried at cost overstates ending inventory and understates COGS until someone finally writes it off.
- Ignoring under- or over-applied overhead. The variance has to be cleared at year end, usually to COGS, or your gross margin drifts away from reality.
Periodic and perpetual systems reach the same place differently
A periodic system computes COGS once, as the residual described above, from a physical count. It is cheap, and it is what this calculator models. Its weakness is that shrinkage — theft, breakage, spoilage, mis-shipment — disappears silently into COGS, because anything missing from the count is presumed sold.
A perpetual system posts a cost-of-sales entry with every sale, so the ledger is always current. The advantage is diagnostic: at the count you compare book inventory to actual, and the difference is measured shrinkage rather than an invisible add-on to COGS. If you run perpetual, use this calculator as a reasonableness check on the total your point-of-sale system produced and investigate a gap of more than a percent or two.
One point surprises people: under FIFO, periodic and perpetual give identical COGS and ending inventory, because costing the oldest units first produces the same layer assignment whether you do it per transaction or once at year end. Under LIFO and weighted average they diverge, since what counts as "most recent" or "average" depends on when you look.
Where COGS fits, and when to use a different tool
COGS sits at the top of a chain. Subtract it from revenue for gross profit, then work down through operating expenses to operating profit and net profit margin. Divide COGS by average inventory and you have inventory turnover, which converts into days on hand. Nearly every cost-side ratio starts here.
Use a different tool when the question changes. To derive ending inventory rather than assume it, work the layers with the FIFO, LIFO or weighted-average calculators. To find the volume that covers fixed costs, you want contribution margin and break-even — and note that contribution margin uses variable cost while COGS under absorption costing includes fixed factory overhead. Treating those two as interchangeable is a classic managerial-accounting error.
Service businesses with no inventory report "cost of revenue" instead: direct labour and directly attributable delivery cost, with no ending-inventory term. The gross margin idea still works; the inventory identity does not apply.
Key terms
- Cost of goods available for sale
- Beginning inventory plus all additions. The pool split between ending inventory and COGS.
- Cost of goods manufactured (COGM)
- The cost of units completed in the period and transferred out of work in process into finished goods.
- Absorption costing
- The required GAAP and tax approach, in which fixed factory overhead is capitalised into inventory rather than expensed as incurred.
- Shrinkage
- The gap between book inventory and counted inventory. Invisible in a periodic system; measurable in a perpetual one.
