Cost of goods sold (COGS) is what the products you sold actually cost you. It’s the number that turns revenue into gross profit, so if it’s wrong, your margins and your taxes are wrong too.
This guide covers the formula, worked examples for a retailer and a wholesaler, whether COGS is an expense, the journal entries, ways to lower COGS, and a free calculator.
The cost of goods sold formula
COGS = Beginning inventory + Purchases โ Ending inventory
- Beginning inventory: the value of stock on hand at the start of the period.
- Purchases: the cost of stock you bought during the period, including freight-in and other costs to get it ready to sell.
- Ending inventory: the value of stock still on hand at the end of the period.
Whatever you started with plus whatever you bought, minus whatever is left, is what you sold.
Use net purchases, not just supplier invoices
Purchases should be what your stock actually cost. Start with supplier invoices, add freight-in and duties, then take off goods you sent back and any discounts you took for paying early or buying in volume:
Net purchases = Purchases + Freight-in and duties โ Purchase returns โ Purchase discounts
For a wholesaler, a supplier credit for a damaged pallet lowers what that stock cost, so it lowers COGS too.
COGS calculator
Enter your inventory and purchase figures for the period. Add revenue to see gross profit and margin.
Loading the COGS calculatorโฆ
Want to work this out every period? The free inventory valuation template values your stock at average cost and calculates COGS for you.
What is cost of goods sold?
Cost of goods sold is the cost of the units you sold in a period, and only those units. For a store or wholesaler that buys finished products, it’s what you paid suppliers for the goods plus what it cost to get them to you.
The usual mix-up is booking every supplier bill as COGS. Say a hardware store buys 200 cordless drills at $45 each in March and sells 120 of them that month. March COGS is 120 ร $45 = $5,400. The other 80 drills ($3,600 at cost) are still inventory, and they become COGS in the month they sell. Expense the whole $9,000 bill in March and March looks worse than it was, while April, when the rest of the drills sell with no cost against them, looks better.
Manufacturers carry more in COGS: raw materials, factory wages and factory overhead. A business that resells what it buys has none of those lines, so its COGS comes down to purchase cost, freight-in and duties.
What’s included in COGS?
For businesses that buy and resell products, COGS usually includes:
- the purchase price of the products;
- inbound freight and shipping to get stock to you (part of your landed cost);
- import duties;
- other direct costs of getting products ready to sell.
It doesn’t include operating costs like rent, marketing, salaries for sales staff, or outbound shipping to customers. Those are operating expenses.

Example: a retail store
A gift shop starts the quarter with $12,000 of stock. During the quarter it buys $18,000 of new stock, including freight. At the end of the quarter, a stock count values what’s left at $9,500.
COGS = $12,000 + $18,000 โ $9,500 = $20,500
If the shop’s sales were $41,000, gross profit is $41,000 โ $20,500 = $20,500, a 50% gross margin.
When every POS sale reduces stock, as it does in Vencru’s accounting software for retailers, the ending figure stops being a guess.

Example: a wholesaler
A beverage distributor starts the month with $85,000 of inventory, buys $140,000 from suppliers and pays $6,000 in inbound freight. Ending inventory is $92,000.
COGS = $85,000 + ($140,000 + $6,000) โ $92,000 = $139,000
See how wholesale accounting and inventory software keeps purchase orders, stock, invoices and COGS in one app.

Is cost of goods sold an expense?
Yes. COGS is an expense on the income statement, but it’s shown separately from operating expenses. Our free income statement template in Excel has a line for it. It sits directly under revenue, and revenue minus COGS gives gross profit. Operating expenses come after that.
Until a product is sold, its cost sits on the balance sheet as inventory, an asset. It only becomes COGS when the sale happens.
Why COGS matters
COGS is the first thing taken off revenue, so an error in it carries straight through to gross profit, net profit and the profit you pay tax on, dollar for dollar.
Go back to the gift shop. If the quarter-end count values the shelf at $10,500 instead of $9,500, COGS falls to $19,500 and gross profit rises to $21,500: a 52.4% margin instead of 50%. The shop owes tax on $1,000 of profit it never made. And because that $10,500 becomes next quarter’s beginning inventory, the extra $1,000 lands in next quarter’s COGS once a correct count catches it.
For the distributor, the risk is the margin it prices from. Say the month’s sales were $165,000. With freight in purchases, gross profit is $26,000, a 15.8% margin. Leave the $6,000 of freight out and the margin reads 19.4%, which looks like 3.6 points of room for volume discounts that the business doesn’t have.
COGS is also a line on your tax return. US sole proprietors work it out in Part III of Schedule C: inventory at the beginning of the year (line 35), plus purchases (line 36) and any other costs, minus inventory at the end of the year (line 41), gives COGS on line 42. That figure carries to line 4, where it comes off your sales to give gross profit. In Canada, form T2125 follows the same order, with opening inventory on line 8300, purchases net of returns, allowances and discounts on line 8320, closing inventory on line 8500 and cost of goods sold on line 8518.
Periodic vs perpetual inventory
- Periodic: you count stock at the end of each period and use the formula above to work out COGS. Simple, but you only know your COGS after each count.
- Perpetual: your system records COGS at the moment of each sale, using a costing method such as average cost or FIFO. You can see gross profit at any time, and stock counts are used to check accuracy.
Your costing method changes the answer
The same units can give different COGS depending on how you value them. Under FIFO, the oldest costs go to COGS first, so when supplier prices rise, COGS comes out lower and the newer, higher costs stay in ending inventory. Average cost spreads price changes across every unit, which smooths gross margin from month to month. Pick one method and keep it. See how FIFO cost of goods sold works and how to choose an inventory valuation method.
Cost of goods sold journal entry
Perpetual system, when you make a sale:
| Account | Debit | Credit |
|---|---|---|
| Cost of goods sold | $X | |
| Inventory | $X |
(Revenue is recorded separately: debit cash or accounts receivable, credit sales.)
In double-entry accounting, both lines post together, so every dollar taken out of inventory shows up in COGS.
Periodic system, at the end of the period: the entries close out purchases and adjust inventory to the counted ending balance, with the difference recorded as COGS.
Common COGS mistakes
- Forgetting inbound freight and duties, which understates COGS and overstates margin.
- Mixing in operating costs, which overstates COGS.
- Using an ending inventory figure that hasn’t been counted or reconciled.
- Changing costing methods partway through the year.
A month-end COGS checklist
- Count or reconcile stock. Do a full count, or check a sample of your biggest lines against your records.
- Value it at cost with the same costing method as last period.
- Add freight-in and duties to the purchases they belong to, not to a general expense account.
- Record supplier returns and credits so purchases are net.
- Write off damaged, expired or missing stock with a note. Otherwise inventory shrinkage sits inside COGS where you can’t see it.
- Run the formula and compare gross margin with last month and the same month last year. A big swing usually points to a counting or costing error before a pricing change.
Counting and subtracting every month? In Vencru’s inventory and accounting software, every invoice or POS sale reduces stock and records cost of goods sold using average costing, so COGS is current on any day of the month. Start 14-day trial
What to do with your COGS number
Gross margin is revenue minus COGS, divided by revenue. Use it to check prices, or set new ones with the free markup calculator.
Divide COGS by average inventory and you get the inventory turnover ratio, the number of times you sold through your stock. Turn that into days and you can see how long cash sits on your shelves: here’s how to compute days sales in inventory.
How to lower your COGS
You lower COGS by paying less for each unit you sell, or by losing fewer of the units you’ve paid for. Switching from average cost to FIFO, or changing how you count, only moves cost from one period to another.
Take early-payment discounts when cash allows
Terms of 2/10 net 30 mean 2% off if you pay within 10 days instead of 30. On the gift shop’s $18,000 of quarterly purchases, that’s $360 a quarter, or $1,440 a year; on the distributor’s $140,000 month it’s $2,800 a month. Passing up the discount is like borrowing from the supplier for 20 days at roughly 37% a year, so take it whenever the cash is there, and record it against purchases so it comes off COGS.
Cut freight per unit
The distributor’s $6,000 of inbound freight is 4.3% of what it paid suppliers. Fewer, fuller shipments usually cost less per case than frequent part loads, and some suppliers drop the freight charge above a minimum order. If consolidating orders took $1,500 a month off that bill, gross margin on $165,000 of sales would go from 15.8% to 16.7% with no change to a single price.
Weigh volume discounts against the cash they tie up
The hardware store sells about 120 drills a month at $45. Its supplier offers 5% off orders of 360, three months’ supply, which saves 360 ร $2.25 = $810 a quarter. Buying monthly keeps about $2,700 of drills on hand on average; buying quarterly keeps about $7,695, so roughly $5,000 more sits on the shelf. That trade works if the drills sell steadily and the store doesn’t need the $5,000 for anything else. On a slow or seasonal line it rarely does (see how to prevent overstocking).
Stop paying for stock you never sell
Shorts, breakage, theft and expired stock all end up in COGS with no sale attached. If a delivery invoiced at 400 cases of $24 sparkling water arrives 40 cases short and nobody checks it, that’s $960 of COGS for goods that never came. Check every delivery against a written purchase order before you pay (the free purchase order generator will do if you don’t have one), claim credits for shorts and damage, and write off breakage with a reason so you can see where the losses come from.
Track COGS automatically with Vencru
Inventory, invoicing and cost of goods sold are tracked together, with double-entry accounting reports on Growth and Enterprise. Start a 14-day trial.
14-day trial ยท No credit card required
Related: How to calculate COGS for a Shopify store ยท What is cost of sales? ยท Inventory turnover ratio ยท How to calculate FIFO cost of goods sold
Frequently asked questions
What is the formula for cost of goods sold?
COGS = beginning inventory + purchases โ ending inventory, for the same period.
Is COGS the same as cost of sales?
They’re often used to mean the same thing. “Cost of sales” is more common for businesses that also sell services. See what is cost of sales.
Does COGS include shipping?
Inbound shipping to get stock to you is usually part of COGS. Shipping orders out to customers is usually an operating expense.
Can COGS be higher than revenue?
Yes, if you sell below cost or write down a lot of stock. It means a gross loss for the period.


