COGS Calculator
Use this calculator to compute your Cost of Goods Sold (COGS) using the standard merchandising formula:
Net Purchases = Purchases + Freight-In - Returns/Allowances - Purchase Discounts
What is the cost of goods sold calculation formula?
The cost of goods sold calculation formula tells you how much it cost your business to produce or purchase the products you actually sold during an accounting period. COGS appears on the income statement and is one of the most important figures for understanding gross profit, pricing strategy, taxes, and operational efficiency.
In plain language, COGS answers this question: “How much inventory value flowed out of the business because those goods were sold?”
Standard COGS formula (for retailers and wholesalers)
If you track detailed purchasing adjustments, net purchases are calculated as:
Put together, the complete expression is:
Why COGS matters so much
- Gross Profit: Gross Profit = Sales Revenue - COGS
- Gross Margin: Gross Margin = Gross Profit / Sales Revenue
- Tax reporting: COGS directly reduces taxable income for many businesses.
- Inventory control: A wrong COGS number can signal shrinkage, counting errors, or valuation issues.
- Pricing decisions: If COGS rises and prices do not, margins compress quickly.
Step-by-step COGS calculation
1) Start with beginning inventory
This is your inventory value at the start of the period (month, quarter, or year). It should match the prior period’s ending inventory.
2) Add purchases and freight-in
Include all inventory bought for resale (or production inputs, depending on your model). Freight-in is usually included because it is part of bringing inventory to a saleable state.
3) Subtract returns, allowances, and discounts
If suppliers credited you for defective items, or if you earned purchase discounts, these reduce what inventory effectively cost you.
4) Subtract ending inventory
Ending inventory represents goods not yet sold. Since COGS should include only sold inventory, you remove the unsold portion.
Example: monthly COGS
Suppose your company has:
- Beginning Inventory: $25,000
- Purchases: $80,000
- Freight-In: $1,500
- Returns/Allowances: $1,200
- Purchase Discounts: $800
- Ending Inventory: $22,000
Net Purchases = 80,000 + 1,500 - 1,200 - 800 = $79,500
COGS = 25,000 + 79,500 - 22,000 = $82,500
If sales revenue was $140,000:
Gross Profit = 140,000 - 82,500 = $57,500
Gross Margin = 57,500 / 140,000 = 41.1%
COGS for manufacturers: a quick note
Manufacturers often use a two-step process:
- Cost of Goods Manufactured (COGM) first
- COGS second, based on finished goods flow
A common manufacturing COGS structure is:
And COGM itself includes direct materials, direct labor, and manufacturing overhead adjusted for work-in-process inventory.
Inventory valuation method can change COGS
Even with the same unit sales, COGS can differ depending on your inventory costing method:
- FIFO (First-In, First-Out): older, often cheaper units are expensed first in inflationary periods.
- LIFO (Last-In, First-Out): newer, often more expensive units are expensed first (where permitted).
- Weighted Average: smooths unit costs across purchases.
This is why two similar businesses can report different COGS and gross margins.
Common mistakes when calculating COGS
- Using sales data instead of inventory flow data
- Forgetting freight-in and landed costs
- Not subtracting returns/discounts
- Using an inaccurate ending inventory count
- Mixing period dates (e.g., purchases from one month with inventory from another)
- Including overhead expenses that belong in operating expenses, not COGS (for non-manufacturers)
How to improve COGS accuracy every month
Build a simple close checklist
- Reconcile inventory sub-ledger to general ledger
- Confirm all purchase invoices for the period are posted
- Record returns and discounts before final reporting
- Perform cycle counts or a full count for critical SKUs
- Review unusual gross margin swings by product line
Watch key metrics
- Inventory turnover: COGS / Average Inventory
- Gross margin by SKU: helps identify underpriced products
- Shrinkage rate: flags theft, damage, or process issues
Final takeaway
The cost of goods sold calculation formula is simple, but its impact is huge. If your COGS is wrong, your gross profit, taxes, and management decisions are all at risk. Use the calculator above each period, keep inventory records clean, and review trends—not just one-time results.