Skip to content

Cost of Goods Sold Calculator

Calculate cost of goods sold from opening inventory, purchases and closing inventory, or from purchase layers by FIFO or average cost, with gross margin.

Calculator Details

Cost of goods sold:$81,000.00See results ↓

Inventory totals for the year (tax form), or purchase layers with a cost-flow method

Cost of inventory at the start of the year (last year’s closing inventory)

Goods and materials bought for resale during the year, before tax you recover

Shipping, customs and brokerage to bring the goods in

Goods sent back to suppliers, allowances and early-payment discounts

Cost of inventory on hand at year end (lower of cost and net realisable value)

Net sales for the year (for gross profit and margin)

Your Results

Cost of goods sold: $81,000.00

Cost of goods sold

$81,000.00

Goods available $106,000.00 less closing inventory

Gross profit

$69,000.00

On sales of $150,000.00

Gross margin

46%

Closing inventory

$25,000.00

Cost of goods sold is $81,000.00. On sales of $150,000.00 that leaves a gross profit of $69,000.00, a 46% gross margin, with $25,000.00 of inventory left.

Compare scenarios

Save these inputs as a scenario, change them, and compare the results side by side.

Loading, available in a moment

Detailed Breakdown

Cost of goods sold on CRA Form T2125, Part 3D
ItemLineAmount
Opening inventory8300$20,000.00
Purchases, net of returns and discounts (freight-in included)8320$86,000.00
Direct wage costs8340$0.00
Other costs8450$0.00
Goods available (subtotal)3W$106,000.00
Closing inventory8500$25,000.00
Cost of goods sold8518$81,000.00
Gross profit8519$69,000.00

Leave out GST/HST you claim back as input tax credits (CRA T4002).

How This Calculator Works

How cost of goods sold is calculated

COGS = opening inventory + purchases (net of returns, plus freight-in) + direct costs − closing inventory

FIFO: oldest layers first; weighted average: total cost ÷ total units × units sold; gross margin = (sales − COGS) ÷ sales

Rounding: COGS, gross profit, inventory values and cost per unit are rounded half up to the cent, and the gross margin to 2 decimal places, only at the output; the working keeps full precision. Units sold are rounded half up to a whole unit.

Your numbers: $20,000.00 + $85,000.00 + $2,500.00 − $1,500.00 − $25,000.00 = $81,000.00. Gross profit $150,000.00 − $81,000.00 = $69,000.00 (46%).

Frequently Asked Questions

What is the formula for cost of goods sold?

COGS = opening inventory + purchases (net of returns and discounts, plus freight-in) + direct labour and other production costs − closing inventory. With $20,000 of opening inventory, $86,000 of net purchases and $25,000 left at year end, COGS is $81,000.

Where does COGS go on my Canadian tax return?

Sole proprietors and partners report it in Part 3D of Form T2125: opening inventory on line 8300, purchases net of returns, allowances and discounts on line 8320, direct wage costs on 8340, subcontracts on 8360, other costs on 8450 and closing inventory on 8500, giving cost of goods sold on line 8518 and gross profit on line 8519. Leave out GST/HST you claim back as input tax credits.

Can I use LIFO in Canada?

No. IFRS (IAS 2) and Canadian ASPE (Section 3031) both prohibit LIFO, and the CRA doesn’t accept it for tax. Canadian businesses use FIFO, weighted average cost or, for unique items, specific identification. LIFO is allowed for US tax if it is also used in the financial statements (the LIFO conformity rule).

What is the difference between FIFO and weighted average?

FIFO assumes the oldest stock is sold first, so cost of goods sold uses older prices and ending inventory is valued at the most recent ones. Weighted average spreads the total cost evenly over every unit available. When prices are rising, FIFO gives a lower COGS and a higher gross profit than weighted average.

Is freight part of cost of goods sold?

Freight-in, duties and brokerage to bring goods to your premises are part of their cost, so they go into purchases and COGS. Shipping to your customers (freight-out) is a selling expense, not part of COGS.

What is a good gross margin?

It depends entirely on the industry: grocery stores often run on 25% or less, many retailers 30–50%, and software or services far higher. Compare your margin with your own past years and with businesses like yours; a falling margin usually means costs are rising faster than prices or shrinkage is growing.

How do I value closing inventory?

Count what is on hand at year end and value it at cost, or at fair market value (net realisable value) if that is lower, the same way each year. The CRA lets most businesses use the lower of cost and fair market value for each item or class, or fair market value for all of it (T4002, chapter 3). The value you choose sets this year’s COGS and next year’s opening inventory.

The totals mode follows the periodic formula on CRA Form T2125 Part 3D (lines 8300–8519) and IRS Schedule C Part III (lines 35–42); freight-in is added to purchases and subcontracts are part of other costs. Layers use FIFO and weighted average (IAS 2, ASPE 3031) and, on the US page, LIFO; the weighted average is periodic (one average for the whole period), not a moving average after each sale. It leaves out specific identification, the retail method, perpetual moving averages, write-downs to net realisable value, shrinkage, LIFO reserves and dollar-value pools, capitalisation of overhead under IRC §263A, and personal-use withdrawals. Your accountant's method and the tax form govern.

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.

Spotted a wrong result or a bug? Report a problem

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy