Cost of Goods Sold (COGS) Calculator
Calculate cost of goods sold for a merchandising or manufacturing business, compare FIFO, LIFO, and Weighted Average results, and see gross profit — with clear supporting visuals.
Background
Cost of goods sold (COGS) is the direct cost of the inventory a business actually sold during a period. It's one of the biggest line items on an income statement, sitting right below revenue and directly determining gross profit — and for many businesses, the inventory costing method chosen (FIFO, LIFO, or weighted average) can shift COGS by a meaningful amount without a single sale actually changing.
How to use this calculator
- Choose Basic COGS for a merchandising or retail business that simply buys and resells inventory — enter beginning/ending inventory and purchases, with freight, returns, and discounts folded in automatically.
- Choose FIFO / LIFO / Avg when you have individual purchase batches at different costs and need to see how the inventory costing method changes COGS and ending inventory.
- Choose Manufacturing for a business that makes its own product — it walks through direct materials, labor, and overhead into Cost of Goods Manufactured, then into COGS via finished goods inventory.
- Choose Estimate (No Count) when you need to estimate COGS or ending inventory without a physical count — useful for interim financial statements, or estimating an inventory loss after a fire, theft, or other disaster.
- Click Calculate to see COGS, a supporting chart, and full step-by-step working.
How COGS works
COGS only captures the cost of inventory that was actually sold during the period — unsold inventory sitting on the shelf stays on the balance sheet as an asset, not an expense.
The basic formula is a balance: Beginning Inventory + Net Purchases − Ending Inventory = COGS. Whatever you started with, plus what you bought, minus what's left, must be what you sold.
FIFO, LIFO, and Weighted Average are just different assumptions about which units left the shelf first — the physical units sold don't change, only which cost tag gets attached to them.
When costs are rising, LIFO produces a higher COGS (and lower taxable income) than FIFO, because it assumes the newest, most expensive units were sold first. When costs are falling, that relationship flips.
For a manufacturer, COGS isn't just "what we bought" — it includes everything spent turning raw materials into a finished, sellable product: materials, labor, and overhead, tracked through work-in-process and finished goods inventory.
The Gross Profit Method estimates COGS from a historical gross profit rate instead of a physical count — useful for interim reporting, or when a fire, flood, or theft makes an actual inventory count impossible.
Formula & Equations Used
Basic COGS: COGS = Beginning Inventory + Net Purchases − Ending Inventory
Net purchases: Net Purchases = Purchases + Freight-In − Returns & Allowances − Purchase Discounts
Gross profit: Gross Profit = Sales Revenue − COGS, and Gross Margin % = Gross Profit / Sales Revenue
FIFO / LIFO: consume purchase layers in order (oldest-first for FIFO, newest-first for LIFO) until units sold is reached; ending inventory cost = Total Cost Available − COGS.
Weighted average: Average Cost = Total Cost Available / Total Units Available, then COGS = Units Sold × Average Cost
Cost of Goods Manufactured: COGM = Direct Materials Used + Direct Labor + Overhead + Beginning WIP − Ending WIP
Manufacturing COGS: COGS = Beginning Finished Goods + COGM − Ending Finished Goods
Gross Profit Method (estimate): Estimated COGS = Net Sales × (1 − Gross Profit %), then Estimated Ending Inventory = Beginning Inventory + Net Purchases − Estimated COGS
Example Problems & Step-by-Step Solutions
These cover cases the Quick Examples chips above don't already demonstrate.
Example 1 — Solving for ending inventory
A shop had \)8,000 beginning inventory, bought \$32,000 of net purchases, and its accountant reports COGS of \$34,000. What's the ending inventory?
Step: Rearranging the formula: Ending Inventory = Beginning Inventory + Net Purchases − COGS = \(8,000 + \)32,000 − \$34,000.
Result: Ending inventory = \$6,000.
Example 2 — Weighted average with three layers
Purchases: 50 units at \$8, 70 units at \$9, 30 units at \$11. 100 units are sold. Find the weighted average COGS.
Step: Total cost = 50(8)+70(9)+30(11) = 400+630+330 = \(1,360 for 150 units. Average cost = \)1,360/150 ≈ \$9.067.
Result: COGS = 100 × \(9.067 ≈ \)906.67; ending inventory (50 units) ≈ \$453.33.
Example 3 — Selling more than one layer under FIFO
Layers: 40 units at \$5, 60 units at \$6. All 100 units are sold. What's FIFO COGS?
Step: FIFO consumes every layer in order: 40 × \(5 = \)200, then 60 × \(6 = \)360.
Result: COGS = \(200 + \)360 = \(560; since every unit was sold, ending inventory = \)0.
Example 4 — A manufacturer with no WIP change
A workshop uses \$12,000 of direct materials, \$9,000 of direct labor, and \$5,000 of overhead, with WIP inventory unchanged (beginning = ending). What's Cost of Goods Manufactured?
Step: Since beginning WIP − ending WIP = \$0, COGM is simply the sum of the period's costs: \(12,000 + \)9,000 + \$5,000.
Result: COGM = \$26,000 — when WIP doesn't change, COGM is just this period's total manufacturing cost.
Example 5 — Interim estimate, no loss involved
A retailer needs a quarterly estimate without doing a physical count: \$25,000 beginning inventory, \$80,000 in net purchases, \$95,000 in net sales, and a historical gross profit rate of 35%.
Step: Estimated COGS = \(95,000 × (1 − 0.35) = \)61,750. Goods available = \(25,000 + \)80,000 = \$105,000.
Result: Estimated ending inventory = \$105,000 − \(61,750 = \)43,250 — useful for an interim balance sheet without stopping operations to count stock.
Frequently Asked Questions
Does a higher COGS mean a business is doing worse?
Not necessarily. COGS naturally rises with sales volume — a bigger, more successful business usually has a bigger COGS. What matters more is the relationship between COGS and revenue (the gross margin), not the raw dollar figure.
Why would a company choose LIFO over FIFO, or vice versa?
During inflation, LIFO produces a higher COGS and therefore lower reported taxable income, which can reduce a company's tax bill. FIFO tends to better match the actual physical flow of goods for most businesses and often results in an ending inventory value closer to current replacement cost.
Is COGS the same as operating expenses?
No. COGS covers only the direct cost of the inventory sold. Operating expenses — rent, marketing, administrative salaries — are costs of running the business that aren't tied to a specific unit sold, and they're subtracted separately, after gross profit.
What's the difference between Cost of Goods Manufactured and Cost of Goods Sold?
Cost of Goods Manufactured (COGM) is what it cost to finish production during the period — it becomes part of finished goods inventory. COGS is what it cost to produce the units that were actually sold, which may include finished goods that were manufactured in an earlier period.