Free Cost of Sales Calculator

A cost of sales calculator finds the cost of inventory sold during a period: opening inventory plus net purchases, minus closing inventory. Add revenue to see how much gross profit those sales leave behind.

Your inventory figures

All amounts are USD. Use the same accounting period and inventory valuation method throughout. The starting values are an illustrative example.

Inventory value at the start of your period.

Purchases plus applicable direct costs, less returns and discounts. Do not count costs twice.

Inventory value remaining at the end of that same period.

Net sales for the same period, to calculate gross profit and margin.

Your cost of sales

Opening inventory
$10,000.00
+ Net purchases
$25,000.00
Goods available for sale
$35,000.00
− Closing inventory
$8,000.00
Cost of sales
$27,000.00
Gross profit
$18,000.00
Gross margin
40.00%

Gross profit excludes operating expenses, interest and income taxes. It is not net profit.

Understand the formula

Opening inventory + net purchases − closing inventory = cost of sales

Closing inventory is subtracted because those goods have not yet been sold. This worksheet covers inventory-based cost of sales. Service businesses may instead total direct delivery costs. This is a planning estimate, not a tax return or a substitute for your accounting records.

Reference: IRS Publication 334, figuring cost of goods sold. Treatment of direct costs depends on your accounting method.

Cost of sales questions

How do you calculate cost of sales?

For an inventory-based business, cost of sales equals opening inventory plus net purchases minus closing inventory. Use values from the same accounting period. For example, $10,000 + $25,000 − $8,000 = $27,000.

Are cost of sales and cost of goods sold the same?

For businesses selling inventory, the terms often describe the direct cost of the goods sold. Cost of sales can also include direct service-delivery costs, but this calculator uses the inventory-based COGS formula.

What should I include in net purchases?

Use purchases after returns and discounts, plus applicable direct costs such as freight-in, direct labor and production overhead if those costs are not already included in your inventory figures. Include each cost only once and apply a consistent accounting method.

How are gross profit and gross margin calculated?

Gross profit is revenue minus cost of sales. Gross margin is gross profit divided by revenue, multiplied by 100. A negative result means cost of sales exceeds revenue; gross margin is undefined when revenue is zero.

Does this calculator save my financial data?

The calculator computes results in your browser. It does not save or transmit the inventory and revenue figures you enter. Reloading the page restores the illustrative example.

Connect your sales to customer journeys

DripAgent helps teams plan lifecycle email for onboarding, activation and retention.

Explore DripAgent