Free tool
Cost of goods sold formula & COGS calculator
Cost of goods sold formula: beginning inventory plus purchases minus ending inventory, all at cost, gives what the stock you sold cost you, for online sellers and retailers closing a month or a year. Enter the three figures to calculate cost of goods sold.
- Free to use
- No sign-up
- Formula shown
- Updated as you type
Your inventory and purchases
Cost of goods sold
$1,200,000
- Goods available for sale
- $1,520,000
- Average inventory
- $300,000
- Inventory turnover
- 4 turns
Beginning inventory plus purchases, less what is still on hand at the end.
How to calculate cost of goods sold
Add purchases to beginning inventory, then subtract ending inventory, all at cost: $40,000 of opening stock, $25,000 of purchases and $35,000 of closing stock is $30,000 of cost of goods sold.
For a month, take the opening stock at cost, add what you bought in the month including freight and duty, and subtract the closing count at cost. The figure is only as good as the two counts. If the closing count is an estimate, cost of goods sold absorbs the error, so a month that looks unusually profitable often has an over-counted closing stock behind it. Use the same costing basis at both ends of the period, whether that is average cost or first in, first out. The result feeds gross margin directly: $50,000 of net sales against that $30,000 is $20,000 of gross profit, a 40% gross margin.
Is cost of goods sold an expense?
Yes: cost of goods sold is the expense for the stock you sold, shown on the income statement directly below revenue, but buying inventory is not an expense until those goods sell.
Suppose you pay a supplier $25,000 in March and sell $10,000 of that stock, at cost, in the same month. March carries $10,000 of cost of goods sold; the other $15,000 sits on the balance sheet as inventory until it sells. That is why a seller can be profitable on paper and short of cash: the money left the bank in March, the expense arrives month by month as the units sell. A US sole proprietor reports the same calculation on Schedule C, Part III. The guide to cost of goods sold for online sellers walks through the income statement and Schedule C lines.
COGS for online sellers: what to include (landed cost, fees, shipping-in)
Include what it cost to get each unit ready to sell: the supplier's price, inbound freight (shipping-in), duties and tariffs, customs brokerage and the product's own packaging; leave out marketplace selling fees, advertising and outbound shipping to customers.
That bundle is the landed cost, and the landed cost calculator spreads freight and duty across the units of one shipment. Freight to bring stock to where it will be sold, including a marketplace's fulfillment center, belongs with it. Referral fees, payment processing and per-unit fulfillment fees are costs of selling, not part of what the inventory cost, so they stay out of inventory value; some sellers show them in cost of sales on their own P&L and others as selling expenses, so pick one and keep it. Since the US suspended the $800 de minimis exemption for imports from every country in August 2025, duty lands on small parcels that used to clear without it, so a landed cost set before then is probably too low.
What decisions does COGS feed
Gross margin, inventory turnover and days of stock all start from cost of goods sold, so it decides which products are worth reordering and how much cash stock is tying up.
Revenue less cost of goods sold is gross margin. Cost of goods sold divided by average inventory is turnover, and the days in the period divided by turnover is how many days the stock you hold lasts at the current rate of sale. A product with a healthy margin but slow turnover can still be a poor use of cash, which is why the three are read together.
Cost of goods sold formula: the COGS equation for resellers and makers
Cost of goods sold = beginning inventory + purchases − ending inventory
Manufacturing COGS = direct materials + direct labor + manufacturing overhead + (beginning WIP − ending WIP) + (beginning finished goods − ending finished goods)
- Beginning inventory
- Stock on hand at cost when the period opened, usually last period's ending count.
- Purchases
- Cost of stock bought in the period, including inbound freight and duties.
- Ending inventory
- Stock still on hand at cost when the period closed.
- Direct materials
- For a manufacturer: materials used in production in the period.
- Direct labor
- For a manufacturer: wages of the people making the product.
- Manufacturing overhead
- For a manufacturer: indirect production costs such as factory rent, utilities and equipment depreciation.
- WIP
- Work in progress: partly finished goods at cost. A drop in WIP adds to COGS; a build-up holds cost back.
- Finished goods
- Completed goods not yet sold, at cost. A drop adds to COGS; a build-up holds cost back.
Worked example
- Beginning inventory of $280,000 plus $1,240,000 of purchases makes $1,520,000 of goods available for sale.
- Ending inventory counts $320,000 still on hand.
- Cost of goods sold is $1,520,000 − $320,000 = $1,200,000.
- Average inventory is $300,000, so the period turned stock $1,200,000 ÷ $300,000 = 4 times.
When it applies
- A reseller working out cost of goods sold from a periodic count and purchase records.
- An online seller closing a month or a year across Shopify, Amazon and other channels, from a stock count or inventory report valued at cost.
- A maker checking production cost against stock movement, using the manufacturing formula above.
When it breaks down
- Ending inventory above beginning inventory plus purchases means a count or a purchase total is missing, so the calculator refuses it.
- Shrinkage, damage and write-offs land in cost of goods sold by this method; separate them if you need to see them.
- It gives one total for the period, not cost of goods sold per SKU or per channel. A system that costs each sale as it ships holds that detail; the periodic formula is the cross-check.
Common mistakes
Leaving out inbound costs
Freight, duties and other landed costs belong in purchases, or cost of goods sold comes out low and margin high.
Counting at selling price
Beginning and ending inventory must be at cost, the same basis as purchases.
Including operating expenses
Rent for the shop, marketing and office wages are operating expenses, not cost of goods sold.
Expensing stock when you pay for it
A large purchase order paid in December is not December's cost of goods sold. It is inventory until it sells, so whatever is still on hand at the close sits in ending inventory.
Skipping the WIP change
A manufacturer that builds up work in progress has spent money that has not yet become cost of goods sold.
Questions
What does a cost of goods sold calculator tell me?
A cost of goods sold calculator tells you what the stock you sold during a period cost you to buy and land, using the periodic method: beginning inventory plus purchases minus ending inventory, all at cost. Enter the value of stock on hand when the period opened, the cost of everything you bought during it including inbound freight and duty, and the value still on hand at the close. With $40,000 of opening stock, $25,000 of purchases and $35,000 of closing stock, cost of goods sold is $30,000. Subtract it from net sales for gross profit. It does not tell you which SKUs or channels made money; that needs a cost on each unit sold.
What is the cost of goods sold formula?
Cost of goods sold = beginning inventory + purchases − ending inventory, all valued at cost. Beginning inventory plus purchases is the cost of goods available for sale; whatever is not still on hand at the close was sold, used, lost or written off, and the formula counts all of it as cost of goods sold. A manufacturer replaces purchases with direct materials, direct labor and overhead, then adjusts for the change in work in progress and finished goods. Both versions are the same identity, so the answer is only as accurate as the inventory values at either end of the period.
How do you calculate manufacturing COGS?
Add direct materials, direct labor and manufacturing overhead for the period, then add the fall (or subtract the rise) in work in progress and in finished goods. For example, $50,000 of materials, $20,000 of labor and $10,000 of overhead is $80,000 of production cost. If work in progress rose by $5,000 and finished goods fell by $3,000, cost of goods sold is 80,000 − 5,000 + 3,000 = $78,000. Overhead has to be allocated to production on a consistent basis, such as machine hours, or the result moves with the allocation rather than with the business.
Is COGS the same as cost of sales?
For a business that sells goods, the two terms are used for the same figure: the cost of the products that sold in the period. Some companies widen cost of sales to include costs of delivering the sale, such as outbound shipping or fulfillment, which is a policy choice that changes gross margin without changing profit. When you compare your gross margin with another seller's or with a benchmark, check which costs each one puts above the gross profit line before reading a gap as better or worse buying.
What is not included in COGS?
Selling, marketing, admin and other operating expenses that do not go into buying or making the goods. For an online seller that usually means marketplace referral fees, payment processing, advertising, software, office costs and storage once the stock is ready to sell. Outbound shipping to customers is most often recorded as a selling or fulfillment expense, although some businesses include it in cost of sales. Whichever you choose, apply it every period, so that a month-on-month change in gross margin reflects the business rather than a reclassification.
What do I do with COGS next?
Subtract it from net sales for gross profit, and divide gross profit by net sales for gross margin. Divide it by average inventory for the inventory turnover ratio, or divide average inventory by it and multiply by the period's days for days inventory outstanding. Those three numbers together show whether stock is earning its keep: a product with a healthy margin can still be a poor use of cash when it turns slowly. The related calculators on this page use the same cost basis, so the figure you enter here carries straight into them.
Related
- Inventory turnover ratio calculator
- Days inventory outstanding formula & days in inventory calculator
- Landed cost calculator
- Average inventory calculator
- GMROI calculator
- Margin calculator
- Cost of goods sold for online sellers
- Profit by SKU
- Margin by SKU and channel
- From dollars at stake to a cash plan
- Skuvelo vs Cin7
- Skuvelo vs Inventory Planner
- How Skuvelo plans inventory
Published by Skuvelo. Results are estimates computed from the figures you enter, not a reading of your own sales or stock.
A calculator answers once. Skuvelo keeps answering.
This tool computes one number from what you type. Skuvelo computes it continuously, for every SKU, from your own sales and stock.