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, 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.
COGS calculator
Enter your inventory and purchase figures for the period. Add revenue to see gross profit and margin.
Loading the COGS calculator…
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;
- 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.
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
Is cost of goods sold an expense?
Yes. COGS is an expense on the income statement, but it’s shown separately from operating expenses. 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.
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.
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.)
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.
Track COGS automatically with Vencru
In Vencru, every invoice or POS sale reduces stock and records cost of goods sold using average costing, so your gross profit is always current without a month-end calculation. Inventory, invoicing and double-entry accounting come together on every plan. Start free.
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.


