Free calculator
Cost of goods sold calculator
Cost of goods sold = beginning inventory plus net purchases and freight-in, minus ending inventory, all valued at cost for the same period.
Drafted with AI assistance and checked against the primary sources listed on this page. How we make these pages
Result
- Cost of goods sold
- $41,000
- Goods available for sale
- $62,000
- Gross profit
- $31,000
- Gross margin
- 43.1%
At a glance
- Inputs come from
- Prior balance sheet, Purchases and Freight-in accounts, period-end count
- Result is expressed as
- Dollars of cost, plus gross profit and margin if you enter net sales
- Convention used
- Periodic method, freight-in entered separately, inventory at cost
- Moves when
- Purchases, freight or either inventory count changes
Formula
COGS = beginning inventory + net purchases + freight-in - ending inventory
When to use it
At each month, quarter or year end on periodic inventory books, before you post the closing inventory entry, and on perpetual books as a check on the COGS account after a physical count.
What it does not prove
The result is only as good as the two inventory counts. It cannot tell a real cost increase from a miscount, a cutoff error or stock that went missing, and it says nothing about operating expenses or net profit.
Worked example
A board game store's third quarter cost of goods sold, July to September 2026
Rook and Pawn Games sells board games, card games and jigsaw puzzles and keeps accrual basis books on the periodic method, counting stock at each quarter end. The June 30, 2026 count valued inventory at $18,500. July to September 2026 brought $42,800 of vendor bills, $800 of crushed puzzle boxes returned to a distributor for credit, $1,500 of inbound freight and $72,000 of net sales. The September 30, 2026 count, valued at FIFO cost (oldest purchase costs treated as sold first), came to $21,000.
- 1Net purchases: $42,800 of vendor bills minus $800 of purchase returns = $42,000.
- 2Goods available for sale: $18,500 beginning inventory + $42,000 net purchases + $1,500 freight-in = $62,000.
- 3Cost of goods sold: $62,000 minus $21,000 ending inventory = $41,000.
- 4Gross profit: $72,000 net sales minus $41,000 = $31,000.
- 5Gross margin: $31,000 / $72,000 = 43.1%.
Rook and Pawn reports $41,000 of cost of goods sold for the third quarter of 2026, $31,000 of gross profit and a 43.1% gross margin.
How to calculate cost of goods sold, step by step
- Take beginning inventory from the prior balance sheet and tie it to that period's count sheet.
- Total the Purchases account, net of trade discounts, returns and allowances, and goods taken for personal use.
- Add the Freight-in account: inbound shipping, duties and cartage on goods bought for resale.
- Count stock on the last day and value it at cost under your cost-flow method.
- Subtract ending inventory from goods available to get COGS; net sales minus COGS is gross profit.
Where opening stock, purchases, freight-in and the ending count come from
Rook and Pawn's beginning inventory is the $18,500 on its June 30, 2026 count sheet. IRS Publication 334 (2025) says opening inventory will usually be identical to the prior closing inventory. Purchases use the prices you actually pay, so trade discounts reduce cost, returns come off, and games the owner takes home are excluded and charged to Owner's draw.
Publication 334 counts freight-in, express-in and cartage-in on merchandise as part of cost of goods sold, so check that inbound freight was not coded to a shipping expense account. The September 30, 2026 entry below closes Purchases, Purchase returns and Freight-in and resets Inventory to the count. Publication 334, chapter 6, maps these figures to Schedule C lines 35 to 42; a CPA or enrolled agent can prepare that return.
| Account | Debit ($) | Credit ($) |
|---|---|---|
| Inventory | 2,500 | |
| Cost of goods sold | 41,000 | |
| Purchase returns and allowances | 800 | |
| Purchases | 42,800 | |
| Freight-in | 1,500 |
How periodic and perpetual books use the formula
On periodic books, the formula is the COGS figure: nothing reaches Cost of goods sold until the period-end entry, so gross profit is unknown until the count. Rook and Pawn's inventory rose $2,500 during the quarter, so that much of the $43,500 it bought, freight included, stays on the balance sheet.
On perpetual books, accounting software debits Cost of goods sold and credits Inventory at cost with each sale, so the formula is a check. If Rook and Pawn kept perpetual books and its records showed $21,450 on hand against the $21,000 count, the $450 gap is shrinkage (damaged boxes, theft or receiving errors), booked to Cost of goods sold or a shrinkage account.
| Account | Debit ($) | Credit ($) |
|---|---|---|
| Cost of goods sold | 450 | |
| Inventory | 450 |
Comparing second and third quarter COGS as a share of net sales
COGS in dollars rises with sales, so compare it as a share of net sales against your own earlier periods. Rook and Pawn's cost of goods sold was 60.3% of net sales in the second quarter of 2026 and 56.9% in the third, so gross margin rose 3.4 percentage points, from 39.7% to 43.1%.
Before crediting a price increase or a richer product mix, ask what moved. A higher ending count lowers COGS dollar for dollar, so an overstated count looks like a better margin. Inventory grew $2,500 in the third quarter against $1,700 in the second. Confirm the September 30, 2026 count left out consigned games (stock a publisher placed with the store but still owns) and included everything received by that date.
| Line | Q2 2026 | Q3 2026 |
|---|---|---|
| Beginning inventory | $16,800 | $18,500 |
| Net purchases | $39,000 | $42,000 |
| Freight-in | $1,300 | $1,500 |
| Goods available for sale | $57,100 | $62,000 |
| Ending inventory | $18,500 | $21,000 |
| Cost of goods sold | $38,600 | $41,000 |
| Net sales | $64,000 | $72,000 |
| Gross margin | 39.7% | 43.1% |
How count errors and seasonal buying distort cost of goods sold comparisons
Count errors move profit between periods. A $1,000 overcount at September 30, 2026 cuts third quarter COGS to $40,000 and lifts gross profit to $32,000. The inflated $22,000 becomes fourth quarter beginning inventory, so a correct December 31 count raises fourth quarter COGS by $1,000. Cutoff errors work the same way: goods received September 29 on a bill dated October 2 belong in both September purchases and the count.
Stock a game store buys ahead for holiday sales sits in the September 30 count, so with an accurate count it stays on the balance sheet instead of raising third quarter COGS. Cash basis books that expense purchases when paid carry no inventory balance to plug in, so holiday buying lands in the quarter it is paid; there, compare each quarter with the same quarter a year earlier. The same COGS feeds gross profit, which the SEC's guide to financial statements describes as net revenues minus cost of sales.
Cost of goods sold calculator: common questions
Does cost of goods sold include shipping to customers?
Not in this calculator. Inbound freight on goods bought for resale is cost of goods sold under IRS Publication 334. Shipping orders to customers goes either in selling expenses below gross profit or in cost of sales, as a policy choice. Pick one home and keep it.
Why does the calculator say my COGS is below zero?
Ending inventory is larger than beginning inventory plus everything bought. Look for an unposted vendor bill, counted goods you do not own yet, a mistyped unit cost, or a beginning balance that does not match the prior count.
How do I calculate cost of goods sold in my first year with no beginning inventory?
Enter 0 for beginning inventory. First-period COGS is then net purchases plus freight-in minus the ending count, so $12,000 of purchases, $400 of freight-in and a $7,400 count give $5,000. Take that count on the last day of the period, because it becomes the next period's beginning inventory.
Does the cost-flow method change the result?
Yes, through ending inventory. FIFO, LIFO, weighted average and specific identification cost the units on hand differently when prices change. Under rising costs, LIFO gives higher COGS than FIFO. For tax valuation, the 2025 Schedule C instructions allow cost, lower of cost or market, or another IRS-approved method; a CPA or enrolled agent confirms the tax treatment.
Do I need this calculator if I do not keep inventory?
The 2025 Schedule C instructions let a small business taxpayer (average annual gross receipts of $31 million or less for the 3 prior tax years, and not a tax shelter) skip keeping an inventory if its method clearly reflects income. The 2026 limit is $32 million. A CPA or enrolled agent confirms whether that applies. Without counts, the formula cannot run.
Sources
- Publication 334: Tax Guide for Small Business (Internal Revenue Service)
- Instructions for Schedule C (Form 1040) (2025) (Internal Revenue Service)
- Beginners' Guide to Financial Statements (U.S. Securities and Exchange Commission)
- Rev. Proc. 2025-32, 2026 inflation-adjusted items (Internal Revenue Service)
Keep learning
More bookkeeping calculators
Educational information only. Booksmrt provides bookkeeping services, not tax, legal, audit, or investment advice. Confirm material accounting and tax decisions with the appropriate professional.