COGS Calculator
Work out cost of goods sold from beginning inventory, purchases and ending inventory, with gross profit, gross margin and inventory turnover. Add freight in, direct labor and purchase returns if you have them, and every result shows the working.
Your numbers
Stock on hand at cost on the first day of the period: last period's ending inventory.
What you bought for sale in the period, at the price you actually paid.
Stock still on hand at cost on the last day, from a count.
Freight on what you bought, and wages for making the product. Most resellers have no direct labor.
Sales for the same period, after returns. Gives gross profit and gross margin.
Cost of goods sold (COGS)
–
- Cost of goods available for sale
- –
- Gross profit
- –
- Gross margin
- –
- COGS as a share of sales
- –
- Average inventory
- –
- Inventory turnover
- –
All figures at cost, for the same period. The stock count sets the answer: every dollar of ending inventory you miss adds a dollar to COGS.
The calculation runs in your browser and ParrotNotes does not store your numbers. They sit in the page address so you can bookmark or share the result.
The COGS formula
Cost of goods sold = beginning inventory + purchases − ending inventory. Everything you could have sold in the period is what you started with plus what you bought. Whatever is not on the shelf at the end was sold, or lost, and its cost is your COGS.
Example for a year: $50,000 of beginning inventory and $120,000 of purchases make $170,000 of goods available for sale. A count at year end finds $40,000 of stock, so COGS is $130,000. Add net sales of $200,000 and the page shows $70,000 of gross profit, a 35% gross margin, and inventory turnover of $130,000 ÷ $45,000 = 2.89 times.
Ending inventory is the number to check. It comes from a count, and it moves COGS dollar for dollar: stock you miss in the count turns into cost, and stock you count twice turns into profit that is not there.
What goes in, according to the IRS
IRS Publication 334 sets out the same sum on Schedule C, lines 35 to 42: beginning inventory, purchases, cost of labor, materials and supplies and other costs add up to the cost of goods available for sale, and ending inventory comes off.
Purchases are at the price you actually pay, so trade discounts never enter. Returns and allowances come off. Merchandise you take for personal use comes off too. Freight in on merchandise and raw materials is part of COGS. Containers count only if they are an integral part of the product; otherwise they are a shipping or selling cost. A manufacturer can also include necessary manufacturing overhead such as rent, utilities and depreciation: put it in the "other direct costs" field.
Small business taxpayers may be able to choose not to keep an inventory: Publication 334 for 2025 returns puts the test at average annual gross receipts of $31 million or less for the 3 prior tax years, indexed for inflation, for a business that is not a tax shelter. This page is arithmetic, not tax advice; ask your accountant what applies to you.
Inventory methods: FIFO, LIFO and specific identification
The calculator takes ending inventory as a figure, so it works with any method. The method decides what that figure is. IRS Publication 538 names three ways to identify cost: specific identification, when you can match the actual cost to each item; first in, first out (FIFO), which treats the earliest items as sold first, so what is left is valued at the latest costs; and last in, first out (LIFO), which treats the latest items as sold first.
Identify the cost, then value it. Publication 538 describes two common bases: cost, which for goods you buy means the invoice price minus discounts plus transportation and other charges to acquire them, and the lower of cost or market, which compares each item's market value with its cost and uses the lower one.
When buying prices rise, FIFO gives a lower COGS and a higher ending inventory than LIFO, as the FAQ example shows. Publication 334 asks that your method fits accepted accounting principles for similar businesses, clearly shows income, and stays the same from year to year.
How this differs from the margin and DSI calculators
The margin calculator works on one sale: this item costs that much, at what price do you hit your margin. This page works on a whole period: how much did everything you sold cost, and what gross margin did the business actually make. The days sales in inventory calculator starts where this page stops: bring the COGS here to see how many days your stock sits before it sells.
For distributor and manufacturing sales
Buyers at distributors and retailers think in gross margin and turns, so it helps to know how they get there. A line that earns less margin can still make a customer more money if it turns faster; turnover is on this page next to the margin for that reason. Run the sum with a customer's rough numbers before a line review, and you can talk about their margin in their own terms.
Sources, each read on 2026-11-02. Results are arithmetic on your own numbers, not tax or accounting advice:
- IRS Publication 334 (2025), Tax Guide for Small Business: figuring cost of goods sold on Schedule C, lines 35 to 42; inventories
- IRS Publication 538 (January 2022), Accounting Periods and Methods: identifying cost (specific identification, FIFO, LIFO), valuing inventory
- Wall Street Prep, Inventory turnover: COGS ÷ average inventory; average = (beginning + ending) ÷ 2
Related: the margin calculator for the margin on one sale, the days sales in inventory calculator for how long stock sits, and the profit and loss template to put the COGS line into a full statement.
More for distributor and manufacturing sales: Distributor sales, Industrial sales.
The number starts the margin talk
COGS and gross margin show where a line stands; the review with the customer or supplier decides what changes. Record the conversation in ParrotNotes and you get a transcript, a summary and the action items, so what was agreed is written down.
Get Started FreeRelated tools
- Margin and Markup CalculatorWork out margin, markup and selling price from cost, convert markup to margin, and see what a discount does to your margin before you quote.Open the tool
- Days Sales in Inventory CalculatorWork out days sales in inventory (DSI) from average inventory and cost of goods sold, with inventory turnover for the same period.Open the tool
- Profit and Loss Statement TemplateFill in a profit and loss statement with revenue, cost of goods sold, expenses and net profit, then print it or download a CSV.Open the tool