Cost of Goods Sold Calculator: COGS, FIFO, Average Cost and Gross Margin
By FindMySum · Last reviewed
Cost of goods sold (COGS) is what the goods you sold during the year cost you. It's the first deduction from sales on a business income statement, and the difference is your gross profit: the money left to pay rent, wages, advertising and yourself. Getting it right matters for tax, because every dollar of COGS reduces taxable income, and for pricing, because the gross margin tells you whether your prices cover what the goods cost.
This calculator works two ways. Year totals follow the formula on the tax forms: opening inventory, purchases, closing inventory. Purchase layers apply a cost-flow method, FIFO or weighted average, to a list of what you bought at each price, for the cost of each sale and the value of what's left.
The formula
COGS = opening inventory + net purchases + direct costs − closing inventory
- Opening inventory is last year's closing inventory, at cost.
- Net purchases are what you bought for resale, plus freight-in, duties and brokerage to bring them in, minus returns to suppliers, allowances and early-payment discounts.
- Direct costs apply if you make what you sell: direct labour, subcontracts and other production costs.
- Closing inventory is what's on hand at year end, from a physical count, valued at cost or at fair market value if that's lower.
Opening inventory plus everything you added is the cost of the goods available for sale. Whatever isn't in closing inventory was sold (or lost, stolen or thrown out, which is why shrinkage shows up as higher COGS).
On Form T2125
Canadian sole proprietors report COGS in Part 3D of Form T2125, Statement of Business or Professional Activities. The calculator's table lists the lines: 8300 opening inventory, 8320 purchases net of returns, allowances and discounts, 8340 direct wage costs, 8360 subcontracts, 8450 other costs, 8500 closing inventory, then 8518 cost of goods sold and 8519 gross profit. If you're registered for GST/HST and claim input tax credits, leave the tax out of every amount. US sole proprietors use Part III of Schedule C (lines 35 to 42); the US version of the page labels the lines that way.
Worked example
The calculator opens on a small retailer's year:
- Opening inventory $20,000.
- Purchases $85,000 plus $2,500 of freight-in, less $1,500 of returns and discounts: $86,000 net.
- Goods available: $106,000.
- Closing inventory from the year-end count: $25,000.
- Cost of goods sold: $81,000 (line 8518).
- Sales of $150,000 leave a gross profit of $69,000, a 46% gross margin (line 8519).
Cost-flow methods: FIFO and weighted average
When you buy the same item at different prices through the year, you need a rule for which cost goes with each sale. Enter the layers in date order, with opening stock first, as units@cost: "100@10, 200@12, 150@13".
- FIFO (first in, first out) sells the oldest units first. Selling 300 of the 450 units above costs 100 × $10 + 200 × $12 = $3,400, and the 150 units left are valued at the latest price, $1,950.
- Weighted average cost divides the total cost by the total units: $5,350 ÷ 450 = $11.89 a unit, so 300 units cost $3,566.67 and the 150 left are $1,783.33.
At $20 a unit, FIFO gives a gross profit of $2,600 (43.33%) and weighted average $2,433.33 (40.56%). When prices are rising, FIFO always shows the lower COGS and the higher profit, because the cheaper old stock is expensed first.
LIFO (last in, first out) is not allowed in Canada: IFRS and ASPE both prohibit it, and the CRA doesn't accept it for tax. It is still allowed for US tax, and the US version of this calculator shows it: the same 300 units would cost $3,750.
Choosing and keeping a method
Pick the method that fits how your goods move and use it consistently from year to year; switching changes your profit without changing your business. Accounting standards require the same cost formula for inventories of a similar nature and use. Whatever the method, value closing inventory carefully: an overstated count understates COGS and overstates profit (and tax), and the error reverses next year when that closing inventory becomes opening inventory.
What this calculator leaves out
It doesn't handle specific identification, the retail method, moving-average costing after each sale, write-downs to net realisable value, LIFO reserves or dollar-value pools, US uniform capitalisation rules, or goods taken for personal use. It also doesn't split costs between COGS and operating expenses for you: only costs of buying or making the goods belong in COGS.
More questions
Is cost of goods sold an expense?
Yes. It is the expense of the goods you actually sold in the period, deducted from sales to give gross profit before operating expenses such as rent, advertising and office wages. Goods you bought but haven't sold aren't an expense yet: they sit on the balance sheet as inventory until they are sold.
Do service businesses have cost of goods sold?
Usually not, or only a small one. A consultant or a bookkeeper sells time, not inventory, so they report expenses but leave the T2125 cost of goods sold section blank. A business that sells both, such as a repair shop selling parts, includes the parts and sometimes the direct labour that goes into a job.
Why did my COGS go down when I bought more inventory?
Because inventory you buy and don't sell ends up in closing inventory, which is subtracted. If you bought $10,000 more stock but it's all still on the shelves at year end, purchases and closing inventory both rise by $10,000 and COGS doesn't change. COGS can only fall that way if closing inventory is overvalued, which is why an accurate year-end count matters.
What is specific identification?
Tracking the actual cost of each individual item sold, used for unique or high-value goods such as cars, jewellery, art or real estate held as inventory. IAS 2 requires it for items that aren't interchangeable. This calculator covers FIFO and weighted average for interchangeable goods; for specific identification, add up the costs of the items sold.
How does COGS relate to inventory turnover?
Inventory turnover is COGS divided by average inventory: here 81,000 ÷ ((20,000 + 25,000) ÷ 2) = 3.6 times a year, or about 101 days of stock on hand. A higher turnover means stock sells faster and less cash is tied up in inventory.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.