What is COGS (cost of goods sold)
COGS is the cost of goods sold (CMV, in Brazilian accounting): what it cost, at acquisition price, exactly the goods that left inventory and became sales in a period — and not what was bought within it.
The difference between buying and selling is what the acronym measures. A store that bought R$ 240 thousand and sold slightly less than it bought did not have R$ 240 thousand of cost in the month: what did not leave is still in inventory, as idle capital, and only becomes cost on the day it is sold.
It is the largest line in the results of anyone who resells, and the quickest reading of the period comes from it: revenue minus COGS is gross margin, the money that exists before paying any selling or overhead expense.
How COGS is calculated
The formula has three inputs and none of them is the total of purchases. It is the two inventories that turn purchases into cost.
COGS = opening inventory + purchases in the period − closing inventory
gross margin = sales revenue − COGS
COGS ratio = COGS ÷ sales revenue
The selling price calculator starts from the product cost on the invoice and the inbound freight — that is where the price that covers the cost of replacing the item comes from, and not only the cost of having bought it.
The COGS of a month with R$ 360,000 in sales
The calculation has two steps, and the second begins where the first stopped: the three inventory figures close into COGS, and it is COGS deducted from revenue that returns gross margin. Inventories enter at cost price, counted on the first and last day of the period.
| Opening inventory | R$ 180,000 |
|---|---|
| Purchases in the periodgoods received, already including freight | + R$ 240,000 |
| Closing inventory | − R$ 195,000 |
| COGS for the period62.5% of revenue | R$ 225,000 |
| Sales revenue | R$ 360,000 |
| Gross margin37.5% of revenue | R$ 135,000 |
Anyone who reads the month's purchases in place of COGS finds R$ 240,000 of cost and a gross margin of R$ 120,000 — R$ 15,000 below the real one. The difference is the inventory that grew during the period, which is committed cash and not cost. In a month of heavy replenishment, this mistake flips the sign of the result and makes a profitable operation look like it is losing money.
What COGS shows and what it does not reach
It is a measure of a period and of the past. Both things matter when you use it to form prices.
COGS is worked out per period and depends on the two inventories, so it is only reliable when the count is. Breakage, damage, expiry and theft leave inventory without becoming sales and, in the formula, quietly enter the cost of what was sold — the ratio rises, gross margin falls and nothing in the report says the cause was shrinkage and not price. Operations that measure shrinkage separately read the same month much more clearly.
It is also historical: it reflects what the goods cost when they came in. Pricing by that value in a period of rising costs means selling at yesterday's price what will be replaced at tomorrow's price. The margin appears in the report and disappears at the moment of repurchase, because the money from the sale does not cover replacing the same item. Whoever forms prices works with replacement cost; whoever determines results works with COGS. Two numbers that share a name in everyday vocabulary.
The gross margin that comes out of here is not contribution margin. Between one and the other sit the taxes on the sale, the commission, the payment processing fee and the delivery freight — everything that is born with the sale and is not in the acquisition cost. A store with a 37.5% gross margin may have a 20% contribution margin and 3% profit, and all three readings are right: they measure different things about the same real.
Finally, what goes into cost depends on the tax regime. Under the real-profit and presumed-profit regimes, the recoverable taxes on the purchase generate a credit and do not make up the cost of the goods; under Simples Nacional there is no such credit and the full invoice amount goes in. Using the rule of one regime in the operation of the other shifts COGS by several percentage points, and shifts every price calculated from it along with it.
Where COGS misleads whoever forms prices
The four below have the same practical effect: a cost that looks exact and is off, producing prices that never make the numbers work.
Calling the month's purchases COGS
It is the most common and the costliest mistake of all, because it happens precisely in months of heavy replenishment — when the volume bought pulls away from the volume sold. The result is an inflated cost, a squeezed gross margin and a price reaction that had no reason whatsoever to exist. The formula with the two inventories exists exactly to separate the two things.
Forming prices from historical cost
The item that came in ninety days ago costs what it used to cost, and the one that will take its place on the shelf costs today's price. In any upward cycle, pricing by the first means financing the customer with working capital: the sale looks profitable and the repurchase comes in higher than the cash it generated. It is the quietest way for an operation to shrink while selling well.
Leaving shrinkage and breakage inside the calculation unnamed
Everything that leaves inventory without becoming a sale is absorbed by the formula as the cost of what was sold. Without a separate line for shrinkage, the COGS ratio rises and the discussion turns to purchase price or selling price, when the problem is in expiry dates, damage or the inventory count. Measuring shrinkage separately is what returns COGS to what it is supposed to measure.
Ignoring the tax credit on the purchase
Under the real-profit and presumed-profit regimes, part of the ICMS, PIS and Cofins paid on the purchase comes back as a credit and is not cost. Adding the full invoice amount to COGS inflates the cost of those who are entitled to the credit, and deducting a credit that Simples Nacional does not give empties out the cost of those who are not. In both cases, the markup calculated on top is wrong in the same direction across the whole catalog.
The terms that decide price together with this one
No pricing term explains itself alone. These are the ones that appear in the same decision, each with its definition and its calculation.
Further reading
What the blog has already published about COGS and about what this definition addresses.
Understanding the calculation is one thing; redoing it across thousands of items is another
For one product, any of these calculations fits in a spreadsheet. Across an entire catalog, with cost changing on every incoming invoice, it stops being done — and the price ends up inherited from the previous month.