Skip to main content
Tallyvane
Open menu

How to calculate COGS: the formula, what counts and a worked example

Cost of goods sold (COGS) is what the products you sold actually cost you. Add opening inventory to what you bought, take away what is left at the end, and you have it. The hard part is deciding what goes into each of those numbers.

Updated 5 min readHow we check facts

One number turned $148,000 into $85,700 gross

Key takeaways

  • COGS = beginning inventory + purchases + other direct costs − ending inventory, all at cost.
  • Inbound freight, packaging that is part of the product and, for makers, direct labour and materials belong in COGS. Rent, marketing and owner’s pay do not.
  • On Schedule C, Part III, outbound shipping to customers is not COGS; it is deducted as a business expense. Your own management P&L can still group it with direct costs.
  • Gross profit = revenue − COGS, and gross margin = gross profit ÷ revenue.

The COGS formula

COGS is the cost of the stock that left your business through sales during a period. You rarely know that number directly, so you work it out from what you started with, what you added and what is left.

Everything is measured at cost: what you paid suppliers, not what customers pay you. The period is usually your tax year, but the same formula works for a month or a quarter if you have stock values for those dates.

COGS = Beginning inventory + Purchases + Other direct costs − Ending inventory Gross profit = Revenue − COGS Gross margin % = Gross profit ÷ Revenue × 100

At a glance: COGS = beginning inventory + purchases + other direct costs − ending inventory, all at cost. Inbound freight, packaging that is part of the product and, for makers, direct labour and materials belong in COGS. Rent, marketing and owner’s pay do not. On Schedule C, Part III, outbound shipping to customers is not COGS; it is deducted as a business expense. Your own management P&L can still group it with direct costs. Gross profit = revenue − COGS, and gross margin = gross profit ÷ revenue.
At a glance: the key facts from this guide.

Where each number comes from

Beginning inventory is last period’s ending inventory. Do not recount it: use the figure from last year’s accounts or tax return, so nothing falls through the gap between years.

Purchases are the cost of stock bought for resale in the period, less trade discounts, returns to suppliers and anything you took out for personal use. Add freight-in, the cost of getting goods to you, because IRS guidance treats it as part of the cost of the goods.

Ending inventory comes from your count on the last day of the period, valued at cost. That count is where most COGS errors start. Our guide to the year-end inventory count covers cut-off, goods in transit, valuation methods and write-downs for damaged stock.

What counts as COGS, and what does not

For a reseller, COGS is mainly the stock itself. For a maker, it also includes the raw materials and the labour that goes into each product. IRS Publication 334 lists containers that are part of the product, freight-in and, for producers, overhead tied to production. It also says not to include anything you pay yourself as labour.

Costs of running and selling the business are operating expenses, not COGS, even if they rise with sales. On Schedule C, outbound shipping to customers, marketplace and card fees, advertising and rent are deducted in Part II.

COGS or operating expense? (Schedule C, reseller or small maker)
CostCOGS (Part III)Expense (Part II)
Stock bought for resaleYes
Freight-in from suppliers, import dutyYes
Raw materials (makers)Yes
Wages of staff who make the productYes
Packaging that is part of the product, such as a candle jarYes
Shipping orders to customers, mailersYes
Marketplace, card and payment feesYes
Advertising and marketingYes
Rent of a shop or office (resellers)Yes
Owner’s drawings or pay to yourselfNoNo

Shipping and fees: tax return vs your own P&L

Many online sellers like to see every cost that comes with an order in one place: the product, the mailer, postage and the marketplace fee. Our profit and loss statement generator lets you do that by listing them under cost of goods sold, which gives a gross margin closer to what each order really earns.

That is fine for your own management accounts, as long as you are consistent. For your tax return, keep the IRS split. Part III of Schedule C should hold inventory, purchases, labour, materials and other production costs. Postage to customers and selling fees belong in Part II. The total deduction is the same either way; what changes is your reported gross profit.

Free toolProfit and loss statement generatorBuild a simple P&L from your revenue and costs, see gross and net margin, and save it as PDF.

Periodic vs perpetual inventory

Under a periodic system you do not track the cost of each sale. You count stock at the end of the period and use the formula above to work out COGS in one go. It suits small sellers with simple ranges and spreadsheets.

Under a perpetual system, your stock or e-commerce software records the cost of each item as it sells, so COGS builds up through the year and you can see gross margin every week. You still count, because records drift from reality through theft, damage and mis-picks. The count adjusts the books, and any shortfall ends up in COGS.

Both systems need a cost-flow method, such as FIFO or weighted average, to decide which purchase price applies to each unit sold. The method you choose changes COGS when your buying prices move, so use one method consistently.

Periodic vs perpetual inventory

Worked example: a home goods reseller for one year

A sole proprietor selling home goods online had $18,500 of stock at cost on 1 January. During the year she bought $62,400 of stock, paid $3,100 in freight and import charges to get it to her, and took $400 of stock home for personal use. Her year-end count valued closing stock at $21,300. Sales for the year, after refunds, were $148,000.

  • Each dollar added to closing stock would cut COGS by a dollar and raise taxable profit by a dollar, which is why the count matters.
  • Her shipping to customers and marketplace fees are not in this table. They go in Part II and reduce net profit, not gross profit.
  • Average inventory was ($18,500 + $21,300) ÷ 2 = $19,900, so stock turned over $62,300 ÷ $19,900 = about 3.1 times in the year, roughly every 117 days.
COGS and gross profit, year ended 31 December
LineSchedule C lineAmount
Inventory at beginning of year35$18,500
Purchases ($62,400) less personal use ($400)36$62,000
Cost of labour37$0
Materials and supplies38$0
Other costs: freight-in and import charges39$3,100
Total goods available for sale40$83,600
Inventory at end of year41−$21,300
Cost of goods sold (to line 4)42$62,300
Revenue$148,000
Gross profit$85,700
Gross margin57.9%
Free toolInventory turnover calculatorFind how many times you sell through your stock in a period, and how many days it sits on the shelf.

How COGS feeds gross margin and your tax return

COGS is the first cost on a profit and loss statement. Revenue minus COGS is gross profit, and gross profit as a share of revenue is gross margin. If your gross margin is falling, the cause is in your prices, discounts, supplier costs or product mix, not your overheads.

Check the overall figure against your pricing. A product that costs $42 landed and sells for $100 has a 58% margin, which matches the reseller above. If your product-level margins are much higher than the margin from your COGS formula, look for discounts, write-offs or shrinkage you have not priced in.

On Schedule C, line 42 of Part III carries to line 4, where it is subtracted from gross receipts. Line 33 asks how you value closing inventory: cost, lower of cost or market, or another method. Small businesses with average annual gross receipts of $32 million or less over the three prior years, for tax years beginning in 2026, can choose simpler inventory treatment for tax, but most product sellers still work out COGS this way for their own books.

Margin % = (Price − Cost) ÷ Price × 100 Example: ($100 − $42) ÷ $100 × 100 = 58%

Free toolProfit margin calculatorFind your margin and markup from cost and price, or the price you need for a target margin.

Frequently asked questions

Is shipping included in COGS?

Inbound shipping from suppliers (freight-in) is part of COGS. Shipping orders out to customers is not COGS on Schedule C; it is a selling expense in Part II. Some sellers group it with direct costs in their own P&L, which is fine if you do it consistently.

Can a service business have COGS?

Usually little or none. A service business with no stock records its costs as operating expenses. Materials used up on a specific job, or subcontractors paid to deliver it, are sometimes shown as cost of sales in management accounts.

What if I do not know my beginning inventory?

Use last year’s ending inventory from your accounts or tax return. If this is your first year, beginning inventory is zero and all stock appears as purchases.

Does unsold stock count as an expense?

No. Stock still on hand at the end of the period is an asset. It only becomes part of COGS when it sells, or when you write it off because it is damaged, lost or obsolete.

Is COGS the same as cost of sales?

Yes, for most small businesses. Cost of sales is the more common term in the UK and in service businesses; cost of goods sold is the usual US term for product sellers.

Sources

General information, not financial, tax or legal advice. Rules change and differ by place; check with the official source or a qualified adviser before you act.