What is cost of goods sold?
Cost of goods sold (COGS) is the inventory cost attributable to goods sold in a period. This periodic rollforward uses inventory balances already valued at cost. It does not value stock from transaction lots or choose FIFO, LIFO or an average-cost method.
COGS formula
Formula
COGS = beginning inventory + net inventory additions − ending inventory
Net additions = gross purchases − purchase returns and allowances − purchase discounts + freight-in + other eligible inventory costs
Use opening and closing inventory at cost, not retail selling price, for the same month, quarter or year. Enter gross purchases before the reductions listed separately. If your records already show net purchases including freight, use that amount in purchases and leave the already-included adjustment fields at zero.
Worked example
Beginning inventory of $10,000 plus $15,000 of gross purchases, minus $500 of purchase returns, plus $500 of freight-in gives $25,000 of goods available. Subtract $8,000 of ending inventory: COGS is $17,000. The $8,000 still held in inventory is not included in this period’s COGS.
| Line item | Amount |
|---|---|
| Beginning inventory | $10,000 |
| Gross purchases | $15,000 |
| Purchase returns | −$500 |
| Freight-in | $500 |
| Goods available | $25,000 |
| Ending inventory | −$8,000 |
| COGS | $17,000 |
Which costs belong in purchases?
For a merchandise reseller, start with inventory acquisition costs and applicable freight-in. The landed-cost calculator can help break down one incoming batch. Include only additional costs eligible under your accounting policy, and do not count charges already included in purchases again.
Customer shipping, advertising and marketplace selling fees belong in separate cost analysis for this merchandise inventory rollforward. Manufacturing, inventory adjustments and tax inventory exceptions can require different treatment. Confirm classifications with your accountant; this calculator does not determine tax deductions or prepare a return.
Why does the calculator flag ending inventory?
Ending inventory above goods available produces a negative rollforward. Check the period, opening balance, missing purchases and valuation basis before using that result. Purchase reductions above gross purchases also need review. The tool hides a usable COGS result until these inconsistent inputs are corrected.
Can this calculate profit or inventory quantities?
No. It calculates a period’s inventory cost, not revenue, marketplace payouts or company net profit. Use the margin and markup tool for unit pricing, and keep a stock ledger for quantities and your chosen inventory valuation method. The Shopify COGS guide explains the related store workflow.
Questions sellers ask
Should I use retail prices for inventory?
No. Use opening and closing inventory at cost, not retail selling price, for the same month, quarter or year.
Does this calculate profit?
No. It calculates a period’s inventory cost, not revenue, marketplace payouts or company net profit. Use the margin and markup tool for unit pricing.
Why does the calculator hide my result?
Ending inventory above goods available produces a negative rollforward, and purchase reductions above gross purchases also need review. The tool hides a usable COGS result until these inconsistent inputs are corrected.
Do customer shipping and marketplace fees belong in COGS here?
Customer shipping, advertising and marketplace selling fees belong in separate cost analysis for this merchandise inventory rollforward. Confirm classifications with your accountant; this calculator does not determine tax deductions or prepare a return.
IRS Publication 334 explains purchase reductions, freight-in and ending inventory in the COGS calculation. OpenStax’s inventory-system explanation describes the periodic rollforward. Sources reviewed October 14, 2026. Cost treatment depends on your records and accounting policy.
Once COGS and inventory balances cover the same period, use the inventory turnover calculator to compare turns and days at cost.
Explore more seller tools and Taxomate’s supported accounting workflows for recording actual marketplace fees and settlements.