luckpanda

COGS Formula: How to Calculate Cost of Goods Sold

The COGS formula is beginning inventory + purchases - ending inventory. What goes in, what stays out, and worked examples in dollars and rupees.

On this page

TL;DR: The COGS formula is Beginning Inventory + Purchases − Ending Inventory = Cost of Goods Sold. Purchases means net purchases: add freight-in, subtract purchase returns, trade discounts and goods you took for personal use. Manufacturers add direct labour and factory overhead; service businesses usually have no COGS at all.

Cost of goods sold (COGS) is the cost of the stock you actually sold in a period: what you paid to buy or make it, and to bring it to the shelf. The COGS calculation formula takes the stock you started with, adds what you bought, and subtracts what is still left at the end. Whatever disappeared went out as sales (or as loss, which you should find in a count). In the US, sole proprietors report it on lines 35 to 42 of Schedule C (Form 1040); in India, it is the debit side of the trading account, or the "cost of materials consumed", "purchases of stock-in-trade" and "changes in inventories" lines of a Schedule III profit and loss statement.

What is the cost of goods sold formula?

The cost of goods sold formula is:

COGS = Beginning Inventory + Net Purchases − Ending Inventory

The first two terms together are called goods available for sale. Everything you could have sold during the year was either there on day one or bought during the year. Subtract what is still on hand on the last day and the remainder is the cost of what left.

TermWhat it meansWhere the number comes from
Beginning inventoryCost of stock on hand on the first day of the periodLast period's closing stock (they must match)
Net purchasesStock bought for resale, at the price you actually paidPurchase bills, less returns and discounts, plus freight-in
Goods available for saleBeginning inventory + net purchasesCalculated
Ending inventoryCost of stock still on hand on the last dayA physical count valued at cost (FIFO or weighted average)
COGSGoods available for sale − ending inventoryCalculated

The IRS sets it out the same way. Schedule C line 40 adds lines 35 through 39 (opening inventory, purchases, labour, materials and supplies, other costs) to get the cost of goods available for sale, and line 42 subtracts line 41, the closing inventory. The result goes to line 4 and is subtracted from net receipts to give gross profit (IRS Publication 334, chapter 6).

How do you calculate COGS step by step?

To calculate COGS, work through five numbers in order:

  1. Take beginning inventory from last period's balance sheet. If it does not equal last year's closing stock, something is wrong; the IRS asks you to attach an explanation of any difference.
  2. Add purchases at the price paid. Use the invoice price after trade discounts, not the list price.
  3. Adjust purchases. Subtract purchase returns and allowances, subtract the cost of goods you took for personal or family use, and add freight-in (carriage inwards), import duty and handling to get stock to your premises.
  4. Count and value ending inventory at cost on the last day of the period. Use a physical count or a reconciled perpetual record, then apply your costing method.
  5. Subtract ending inventory from goods available for sale.

Gross profit = net sales − COGS. Gross margin % = gross profit ÷ net sales × 100. If you know COGS and revenue, the gross margin calculator does the second step.

What is a worked example of the COGS calculation?

Retail example in US dollars (from the IRS)

IRS Publication 334 uses this retail illustration for calendar year 2025:

LineAmount
Inventory at beginning of year$37,845
Plus: purchases$285,900
Minus: items withdrawn for personal use$2,650
Goods available for sale$321,095
Minus: inventory at end of year$32,955
Cost of goods sold$288,140

With gross receipts of $400,000 and returns and allowances of $14,940, net receipts are $385,060 and gross profit is $385,060 − $288,140 = $96,920, a gross margin of about 25.2%.

Trading example in Indian rupees (FY 2025-26)

A Pune hardware trader closes the year on 31 March 2026:

ItemAmount
Opening stock on 1 April 2025₹4,20,000
Add: purchases (taxable value, GST excluded)₹18,60,000
Less: purchase returns₹40,000
Add: freight inward₹35,000
Goods available for sale₹22,75,000
Less: closing stock on 31 March 2026₹3,90,000
Cost of goods sold₹18,85,000

If net sales are ₹26,00,000, gross profit is ₹7,15,000 and gross margin is 27.5%. This is exactly the shape of the trading account format: opening stock, purchases and direct expenses on the debit side; sales and closing stock on the credit side; the balance is gross profit.

What is the COGS formula for a manufacturing business?

A manufacturer uses the same logic twice: first to find the cost of goods manufactured (COGM), then to turn COGM into COGS.

  • Direct materials used = beginning raw materials + raw material purchases − ending raw materials
  • Total manufacturing cost = direct materials used + direct labour + manufacturing overhead
  • COGM = beginning work in progress + total manufacturing cost − ending work in progress
  • COGS = beginning finished goods + COGM − ending finished goods

Worked example in US dollars for one year:

StepCalculationResult
Direct materials used$20,000 + $80,000 − $15,000$85,000
Total manufacturing cost$85,000 + $60,000 labour + $45,000 overhead$190,000
COGM$10,000 + $190,000 − $12,000$188,000
COGS$25,000 + $188,000 − $30,000$183,000

IAS 2 Inventories calls the labour and overhead part "costs of conversion" and requires fixed production overhead to be allocated on the normal capacity of the plant, so a quiet month does not load each unit with idle-factory cost.

What is included in COGS and what is not?

COGS includes only costs needed to buy or make the goods and bring them to their present location and condition. That phrase comes from IAS 2 paragraph 10 and is mirrored in India's AS 2 and Ind AS 2. The IRS lists the same items for Schedule C.

Included in COGSNot included in COGS
Purchase price after trade discounts and rebatesSelling costs: advertising, sales commission, freight-out to customers
Freight-in, express-in, cartage-inStorage after goods are ready for sale
Import customs duty and other non-recoverable taxesGST or VAT you recover as input tax credit
Direct labour on the product (manufacturing)Owner's own drawings or salary (Schedule C line 37 excludes amounts paid to yourself)
Factory rent, power, depreciation, supervision (manufacturing overhead)Office rent, accounting, administration
Containers that are part of the productShipping boxes that are not part of the product (a selling expense)
Normal production wasteAbnormal waste, theft beyond normal shrinkage (expensed separately)

Two rules trip up most small businesses:

  • Labour is usually not COGS for a reseller. Publication 334 says labour is "usually an element of cost of goods sold only in a manufacturing or mining business". A shop's counter staff are an operating expense.
  • Recoverable tax is not cost. IAS 2 paragraph 11 counts import duties and taxes "other than those subsequently recoverable". In India, GST you claim as input tax credit under Section 16 of the CGST Act is recovered, so it stays out of purchases. GST that is blocked under Section 17(5) (for example on food and beverages, with exceptions) cannot be claimed and becomes part of the cost of what you bought (CBIC, CGST Act).

How does the inventory method change COGS?

Your costing method decides which purchase prices go into ending inventory, and therefore which go into COGS. With 100 units bought at ₹200 and 100 more at ₹220, and 150 sold:

MethodCOGS for 150 unitsEnding inventory (50 units)
FIFO (oldest cost first)100 × ₹200 + 50 × ₹220 = ₹31,000₹11,000
Weighted average (₹42,000 ÷ 200 = ₹210 per unit)150 × ₹210 = ₹31,500₹10,500
LIFO (newest cost first, US only)100 × ₹220 + 50 × ₹200 = ₹32,000₹10,000

Goods available for sale is ₹42,000 in every row; the methods only split it differently between COGS and closing stock. IAS 2 paragraph 25 allows FIFO or weighted average; LIFO is not permitted under IFRS, Ind AS 2 or AS 2, and is used only under US GAAP and US tax rules. The FIFO vs LIFO guide covers the full comparison. Whatever you pick, apply it consistently: in the US a change of inventory method needs Form 3115.

Inventory is also capped at the lower of cost and net realisable value (IAS 2 paragraph 9). If damaged or slow stock will sell for less than it cost, write it down; the write-down increases expense in that period.

Periodic or perpetual: when is COGS calculated?

Under a periodic system, you calculate COGS once per period with the formula above, after a stock count. Under a perpetual system, every sale posts its own cost (units sold × unit cost) at the moment it happens, and COGS for the period is the sum of those postings.

The two should agree. The difference after a physical count is shrinkage: theft, damage, miscounts and unrecorded issues. A perpetual record does not remove the need to count; it lets you count a slice of items every week instead of everything once a year, which is what cycle counting is for.

What can you calculate once you know COGS?

COGS is the input to four numbers every stock-holding business should watch:

MetricFormulaIRS retail examplePune trader example
Gross margin(net sales − COGS) ÷ net sales25.2%27.5%
Markup on cost(net sales − COGS) ÷ COGS33.6%37.9%
Inventory turnoverCOGS ÷ average inventory8.1 times per year4.7 times per year
Days inventory outstanding365 ÷ inventory turnover45 days78 days

Average inventory here is (opening + closing) ÷ 2: ($37,845 + $32,955) ÷ 2 = $35,400 for the IRS example and (₹4,20,000 + ₹3,90,000) ÷ 2 = ₹4,05,000 for the trader. The trader holds stock for about 78 days before it sells; the US retailer for about 45 days. A margin of 27.5% and a markup of 37.9% describe the same sale, which is why quoting one when you mean the other causes pricing errors (the markup calculator converts between them).

What are the most common COGS mistakes?

  • Opening stock that does not equal last year's closing stock. The IRS asks you to explain any difference; an auditor will too.
  • Valuing closing stock at selling price. Ending inventory is at cost (or net realisable value if lower), never at the price on the tag. Valuing at retail understates COGS and overstates profit.
  • Including GST input credit in purchases. This double counts: you recover the tax and also expense it through COGS.
  • Putting freight-out into COGS. Delivery to customers is a selling expense; freight to bring goods in is COGS.
  • Forgetting personal withdrawals. Goods you take home are drawings, not cost of sales. Publication 334 tells you to credit purchases and charge your drawing account.
  • Ignoring returns. Purchase returns reduce purchases; customer returns reduce sales, not COGS directly (the returned goods go back into stock).

Do service businesses have COGS?

A pure service business usually has no COGS. Publication 334 says a business does not have to figure it "if the sale of merchandise is not an income-producing factor", and gross profit is then simply net receipts. Some service firms report "cost of revenue" or "cost of services" (contractor fees, direct staff time on billable work), but that is a management choice, not the inventory formula. If a service business also sells parts or materials, those materials do go through COGS.

In the US, a small business taxpayer (average annual gross receipts of $31 million or less over the 3 prior tax years for 2025, and not a tax shelter) may choose not to keep inventories for tax, but must still use a method that clearly reflects income.

How do I keep the records COGS needs?

COGS is only as good as two numbers: purchases and the closing count. Keep every purchase bill with its date, quantity, unit cost and freight, net of recoverable tax. Keep a stock register or stock ledger where each receipt and issue is a dated line, and count at least once a year (more often for high-value items). LuckPanda's Inventory module is being built around this record: items, warehouses and stock movements that each carry a date, a quantity and the document behind them, so purchases and closing stock come from the same place as your bills and invoices.

Questions

What is the simplest COGS formula?

Beginning inventory + purchases − ending inventory. For example, $10,000 opening stock + $40,000 purchases − $12,000 closing stock = $38,000 COGS.

Is COGS an expense or a liability?

COGS is an expense. It sits on the income statement directly under revenue and is subtracted to get gross profit. Unsold stock is an asset (inventory) until it is sold.

Is COGS the same as cost of sales?

Mostly. "Cost of sales" is the IFRS and Indian Schedule III term and can include the cost of services delivered; "cost of goods sold" refers to physical goods. For a trader the two numbers are the same.

Does COGS include shipping?

Shipping to bring goods to you (freight-in) is included. Shipping goods out to customers (freight-out) is a selling expense and is excluded.

How do you calculate COGS without ending inventory?

You cannot do it accurately without a closing figure. Either count the stock, use a perpetual record that posts cost on each sale, or, for interim estimates only, use the gross profit method: COGS ≈ net sales × (1 − normal gross margin %).

Is GST included in COGS in India?

No, if you claim it as input tax credit. Purchases are recorded at the taxable value. Only GST that is blocked under Section 17(5) of the CGST Act, or that you are not eligible to claim (for example under the composition scheme), is added to the cost.

Can COGS be higher than revenue?

Yes. It means you sold goods for less than they cost and made a gross loss. Check first for errors: an undercounted closing stock or a missing sales invoice produce the same symptom.

Keep everything you make

Sign in with your email and your drafts become documents in your own business, with clients, payments and books alongside.