Skip to content
Calcipedia
Cost of Goods Sold Calculator instructional illustration

Cost of Goods Sold Calculator

Calculate cost of goods sold from opening inventory, adjusted purchases, freight-in, direct product costs, returns, discounts, and closing inventory.

Last updated

Calculate COGS and gross margin from inventory Enter opening inventory, purchases, and closing inventory to calculate cost of goods sold. Add revenue to see gross profit and gross margin support.

Display currency

Switch the display currency before entering inventory amounts; this changes presentation, not the accounting formula.

Example scenarios

Assumptions

The calculator starts with opening inventory, adds net purchases and direct product costs, subtracts returns, allowances, and purchase discounts, then removes closing inventory to determine COGS. Revenue is optional and only unlocks gross profit and gross margin support.

Result

$288,140.00 COGS

Cost of goods sold from $37,845.00 opening inventory plus $283,250.00 purchases, less $32,955.00 closing inventory.

Result sheet

Opening inventory$37,845.00
Purchases$283,250.00
Freight-in / landed costs$0.00
Other direct product costs$0.00
Less returns, allowances, and purchase discounts$0.00
Net purchases and direct costs$283,250.00
Cost of goods available for sale$321,095.00
Closing inventory$32,955.00
Cost of goods sold$288,140.00
Revenue$385,060.00
Gross profit$96,920.00
Gross margin25.17%
COGS as % of revenue74.83%
Markup on cost33.64%

Inventory movement read

Ending inventory is lower than opening inventory, so the period sold through more inventory cost than it replenished.

The adjusted purchase pool is $283,250.00, so cost of goods available for sale is $321,095.00 before ending inventory is removed.

Gross margin support At revenue of $385,060.00, gross profit is $96,920.00 and gross margin is 25.17%.

Interpretation note

COGS is the inventory cost moved out of stock and into the period's cost of sales. The cost of goods available for sale is the inventory pool before closing stock is removed.

← All Operations calculators

Inventory Accounting

Cost of goods sold calculator guide: opening inventory, purchases, closing inventory

A cost of goods sold calculator shows how much inventory cost moved out of stock and into the period's cost of sales. It starts with opening inventory, adds purchases and direct product costs, subtracts purchase returns, allowances, discounts, and closing inventory, and can also compare the result with revenue to show gross profit, gross margin, COGS as a percentage of sales, and markup on cost.

What cost of goods sold is measuring

Cost of goods sold, or COGS, represents the inventory cost assigned to the goods sold during the period. It is not the same as total purchases. First, a business combines opening inventory, net purchases, freight-in, and other direct product costs to find the cost of goods available for sale. Then it removes the ending inventory that remains unsold. The remainder is cost of goods sold.

This matters because gross profit is based on revenue minus cost of goods sold, not revenue minus purchases alone. A business can buy heavily in one period and sell those goods in another, so inventory timing has to be handled correctly before margin analysis is meaningful.

Core COGS formula

The calculator follows the standard inventory flow used in basic business accounting. Opening inventory and adjusted purchases are combined to create the inventory pool available for sale. Closing inventory is then deducted because those goods remain on hand rather than having been sold during the period.

If revenue is entered, the calculator also estimates gross profit and gross margin. That makes it useful as both an inventory-accounting check and an early pricing or performance review tool.

Net purchases and direct costs = Purchases + freight-in + other direct product costs - returns - allowances - discounts

This adjusted purchase pool is more useful than purchases alone when freight, returns, discounts, or production costs matter.

Cost of goods available for sale = Opening inventory + net purchases and direct costs

This is the total inventory cost available to sell during the period before ending inventory is removed.

Cost of goods sold = Cost of goods available for sale - Closing inventory

This isolates the inventory cost assigned to goods actually sold during the period.

Gross profit = Revenue - Cost of goods sold

Revenue support is optional, but if entered it shows the gross profit generated after product cost is covered.

Purchase adjustments and direct costs

Many COGS worksheets stop at opening inventory plus purchases minus closing inventory. That is enough for a simple classroom example, but real inventory records often need additional lines before the closing inventory step. Freight-in or landed costs can increase the cost of inventory. Purchase returns, allowances, and supplier discounts reduce the purchase pool. Manufacturers may also need direct labor or production overhead that is assigned to the goods produced.

The calculator keeps those adjustments optional so a retailer with a simple purchase ledger can use the basic formula, while a business with freight, vendor credits, or production costs can still model a more realistic cost of goods sold calculation.

Worked example: inventory pool to gross profit

Suppose opening inventory is 37,845, purchases are 283,250, freight-in is 6,250, purchase returns are 3,400, purchase discounts are 1,800, and closing inventory is 32,955. Net purchases and direct costs are 284,300, so cost of goods available for sale is 322,145. Subtracting closing inventory gives cost of goods sold of 289,190.

If period revenue is 385,060, gross profit is 95,870 and gross margin is about 24.90%. The calculator shows that inventory movement and the sales relationship separately so you can confirm the inventory math before interpreting the margin result.

Gross margin, COGS percentage, and markup

Revenue is not required to calculate COGS, but it changes what you can learn from the result. Gross profit shows the money left after product cost. Gross margin shows that gross profit as a share of revenue. COGS as a percentage of revenue shows how much of each sales dollar is consumed by inventory cost, and markup on cost compares gross profit with the COGS base.

Those views answer different questions. A gross margin drop may point to pricing pressure, purchase cost increases, inventory write-downs, freight changes, shrinkage, or a different sales mix. A COGS calculator cannot diagnose all of those causes by itself, but it gives a clearer starting point than a bare COGS total.

How to use COGS results

Use the COGS result to confirm whether reported product cost lines up with your inventory movement and purchasing assumptions. If gross margin looks weaker than expected, check not just revenue but also whether purchases, closing stock, or inventory write-down assumptions changed during the period.

This calculator is intentionally simple. It is most useful for planning, forecasting, or sense-checking period results before moving into a fuller accounting system that handles labor allocation, materials, freight-in, and inventory-method rules in more detail.

Inventory methods and accounting policy limits

The calculator does not choose FIFO, weighted-average cost, specific identification, or another inventory method. Those policies affect how costs are assigned to ending inventory and cost of goods sold, especially when purchase prices are changing. The calculator assumes the opening inventory, purchases, direct costs, and closing inventory figures you enter already reflect the inventory method and accounting policy you intend to use.

For tax filing, audited reporting, or lender-ready statements, reconcile the calculator output to the business's inventory records and applicable rules. The simplified COGS formula is a planning and education tool, not a replacement for accounting policy, tax advice, or inventory-system detail.

Further reading

Frequently asked questions

What is the basic formula for cost of goods sold?

The basic formula is opening inventory plus purchases minus closing inventory. That first creates the cost of goods available for sale and then removes the inventory that remains unsold at the end of the period.

Why is COGS different from purchases?

Purchases show what was bought during the period, while COGS shows the inventory cost assigned to goods actually sold during the period. If inventory levels rise or fall, purchases and COGS will differ.

Do I need revenue to calculate COGS?

No. Revenue is optional. It is only needed if you want the calculator to extend the inventory result into gross profit and gross margin support.

Can closing inventory be larger than goods available for sale?

No. If closing inventory exceeds opening inventory plus purchases, the inputs are inconsistent and the period inventory flow needs to be checked.

Should freight-in be included in cost of goods sold?

Freight-in or landed cost can be part of inventory cost when it is necessary to bring inventory to the place and condition for sale. This calculator includes an optional freight-in line so that purchase costs can be adjusted before ending inventory is removed.

How do returns and purchase discounts affect COGS?

Purchase returns, allowances, and discounts reduce the adjusted purchase pool. Lower net purchases reduce cost of goods available for sale and can reduce COGS if ending inventory does not change.

Is COGS the same as operating expenses?

No. COGS is tied to the cost of inventory sold. Operating expenses are period costs such as rent, administrative payroll, software, marketing, and other overhead that are not assigned to inventory in the same way.

Which inventory method does the calculator use?

It does not choose an inventory method. It assumes your opening inventory, purchases, direct costs, and closing inventory already reflect the method you use, such as FIFO, weighted average, or specific identification.

Can COGS be higher than revenue?

Yes. If COGS is higher than revenue, gross profit is negative and gross margin will also be negative. That can happen with discounts, write-downs, shrinkage, low pricing, or unusual inventory costs.

Also in Operations

Related

More from nearby categories

These related calculators come from the same leaf category, nearby sibling categories, or the same top-level topic.