Cost of Goods Sold Calculator
Results are estimates based on the values you enter. Recheck your inputs and assumptions before using the output for decisions.
Calculate cost of goods sold from beginning inventory, purchases, ending inventory, and net sales.
Cost of Goods Sold Calculator
Free online cost of goods sold calculator to estimate how much inventory cost was actually sold during a period. This calculator is useful for business owners, accountants, ecommerce sellers, retailers, wholesalers, finance teams, and students who want a simple way to measure inventory cost flow and gross profit. Cost of goods sold, often called COGS, is one of the most important numbers in product-based businesses because it directly affects gross profit and margin analysis.
The calculator works with beginning inventory, purchases during the period, ending inventory, and net sales. Beginning inventory is the value of inventory on hand at the start of the period. Purchases are the additional goods bought or produced for sale during the period. Ending inventory is the value of stock still left at the end of the period. Net sales represent the revenue generated from sold goods after returns or allowances if applicable. From these values, the calculator shows goods available for sale, cost of goods sold, gross profit, and gross margin.
The formula of cost of goods sold
Goods available for sale = Beginning inventory + Purchases during period
Cost of goods sold = Goods available for sale – Ending inventory
Gross profit = Net sales – Cost of goods sold
Gross margin = (Gross profit / Net sales) x 100
Here beginning inventory means the inventory value carried into the period, purchases means the inventory bought or produced during the period, ending inventory means the inventory left unsold at the end of the period, and net sales means the revenue earned from the sold goods. COGS shows the cost attached to the inventory that actually left stock and was sold to customers.
Solved Example
Example 1: Find the cost of goods sold if beginning inventory is $30,000, purchases are $85,000, ending inventory is $25,000, and net sales are $150,000.
Solve: Goods available for sale = 30000 + 85000 = $115,000
Cost of goods sold = 115000 – 25000 = $90,000
Gross profit = 150000 – 90000 = $60,000
Gross margin = (60000 / 150000) x 100 = 40%
Example 2: Find the result if beginning inventory is $18,000, purchases are $52,000, ending inventory is $14,000, and net sales are $96,000.
Solve: Goods available for sale = 18000 + 52000 = $70,000
Cost of goods sold = 70000 – 14000 = $56,000
Gross profit = 96000 – 56000 = $40,000
Gross margin = (40000 / 96000) x 100 = 41.67%
Example 3: Find the result if beginning inventory is $45,000, purchases are $120,000, ending inventory is $35,000, and net sales are $220,000.
Solve: Goods available for sale = 45000 + 120000 = $165,000
Cost of goods sold = 165000 – 35000 = $130,000
Gross profit = 220000 – 130000 = $90,000
Gross margin = (90000 / 220000) x 100 = 40.91%
Table of cost of goods sold calculator
| Beginning Inventory | Purchases | Ending Inventory | COGS | Net Sales | Gross Margin |
|---|---|---|---|---|---|
| $18,000 | $52,000 | $14,000 | $56,000 | $96,000 | 41.67% |
| $30,000 | $85,000 | $25,000 | $90,000 | $150,000 | 40% |
| $45,000 | $120,000 | $35,000 | $130,000 | $220,000 | 40.91% |
| $60,000 | $140,000 | $50,000 | $150,000 | $245,000 | 38.78% |
How to use this cost of goods sold calculator
Enter beginning inventory in the proper input field. After that, enter the purchases made during the same accounting period and the ending inventory remaining at the end of that period. Then enter net sales for that same period and click the calculate button. The calculator will show goods available for sale, cost of goods sold, gross profit, and gross margin in the result box. Make sure all inventory values and sales values belong to the same month, quarter, or year so the result stays accurate.
This calculator is useful when reviewing inventory performance, preparing management reports, checking gross margin trends, or pricing products more carefully. If cost of goods sold rises too quickly compared with sales, gross profit can shrink even when revenue looks strong. If ending inventory is overstated or understated, COGS and profit can also be distorted. That is why this calculation matters so much in accounting, operations, and financial planning. It helps connect stock movement with business profitability.
When using the result, remember that inventory valuation methods such as FIFO, LIFO, or weighted average can change the reported inventory values used in the formula. This calculator works from the inventory amounts you enter, so the output depends on the valuation method already used in your records. Even so, it gives a strong practical view of inventory cost flow and margin impact. It provides a fast numerical baseline for gross profit analysis, stock planning, reporting checks, and product business decision-making.