COGS Calculator — Cost of Goods Sold
Free cost of goods sold calculator. Works the IRS Schedule C Part III inventory flow — beginning inventory plus purchases and labour, less ending inventory.
COGS Calculator
Background.
Cost of goods sold is the most commonly miscalculated line on a small business return, and almost always for the same reason: people add up what they spent on stock instead of what they sold. Those are different numbers. Inventory you bought and still hold sitting in a warehouse is an asset, not an expense. It only becomes cost of goods sold when it leaves — which is why COGS is computed from an inventory flow rather than from a bank statement.
The identity is fixed, and both the IRS and international accounting standards describe the same movement. Start with the inventory you were holding at the beginning of the period. Add everything you put into stock during the period: purchases, direct production labour, materials and supplies, and other costs such as containers, packaging and freight-in. That total is goods available for sale. Subtract what you were still holding at the end, and the remainder is what you sold. IRS Schedule C Part III lays it out as lines 35 through 42 exactly that way, and Form 1125-A does the same in eight lines for corporations and partnerships.
This calculator runs that identity in both directions. Forward — the ordinary case — you enter your closing count and get the expense figure. Backward, you enter the COGS your accounting system already produced and get the closing inventory it implies, which is the fastest shrinkage check there is: solve for ending inventory, compare it against your physical count, and the gap is theft, breakage, a miscount, or a costing error. Alongside the primary figure you get goods available for sale, the inventory change for the period, gross profit against your net sales, and COGS as a percentage of revenue.
Two things change the answer that no formula can settle for you. The first is your inventory valuation method. Identical purchases produce different COGS depending on whether you cost them out first-in-first-out, last-in-first-out, or on a weighted average — and in a period of rising prices LIFO pushes the newest, most expensive units into COGS and leaves the oldest, cheapest ones on the balance sheet, reducing reported profit. This is where US and international rules genuinely diverge: IRS Publication 538 lists specific identification, FIFO and LIFO as permitted cost-flow methods, while IAS 2 permits only first-in-first-out and weighted average cost for interchangeable items. A US filer and an IFRS reporter can arrive at legitimately different COGS from identical transactions. If you report under both, they will not agree, and neither is wrong.
The second is which indirect costs you are required to capitalise into inventory rather than deduct immediately. The uniform capitalisation rules of section 263A pull certain indirect production and purchasing costs into inventory cost, with an exemption for smaller businesses whose average annual gross receipts fall below a threshold that is inflation-adjusted and changes from year to year. This page does not guess that threshold or apply the rules for you. If section 263A is in scope for your business, the amount you capitalise belongs in the "Other costs" field, and the figure itself needs to come from your accountant or from the current-year IRS instructions — not from a calculator.
One more scope note before you start. This page assumes you carry inventory. A pure services business has no inventory flow at all; under Regulation S-X the equivalent line is "cost of services", which is a direct-cost total rather than a movement between two counts. If you have no opening and closing stock to count, this identity does not describe your business, and you should be adding up direct costs instead. Enter your figures below, then read the explainer for exactly which costs belong on which line.
What is cogs calculator?
Cost of goods sold is the cost of the inventory a business actually sold during a period. It is computed from the movement of inventory rather than from cash spent, using the identity: beginning inventory + purchases + cost of labour + materials and supplies + other costs − ending inventory = cost of goods sold. The middle five terms sum to goods available for sale. IRS Publication 334 sets this out as Schedule C Part III lines 35 through 42 for sole proprietors, and Form 1125-A carries the identical eight-line structure for corporations and partnerships; line 40 is goods available for sale and line 42 is cost of goods sold. The same principle governs financial reporting. IAS 2 Inventories states that "when inventories are sold, the carrying amount of those inventories is recognised as an expense in the period in which the related revenue is recognised", and defines cost as comprising "all costs of purchase, costs of conversion (direct labour and production overhead) and other costs incurred in bringing the inventories to their present location and condition". On a US public filing, Regulation S-X Rule 5-03 requires registrants to "state separately the amount of (a) cost of tangible goods sold" within costs and expenses applicable to sales and revenues. Cost of goods sold is subtracted from net sales to give gross profit, and it is an absorption-costing figure: it includes fixed production overhead allocated to units, which is what distinguishes it from contribution margin.
How to use this calculator.
- Choose a direction. Solve for cost of goods sold if you have counted your closing inventory. Solve for ending inventory if your accounting system has already produced a COGS figure and you want to see what closing stock it implies — then compare that against your physical count.
- Enter net sales for the period. This is gross receipts less returns and allowances. It does not affect the COGS figure itself; it drives gross profit and the COGS-to-revenue ratio.
- Enter inventory at beginning of year (Schedule C line 35). This must equal the previous period's closing inventory. If the two do not match, stop and reconcile them — every figure downstream inherits the discrepancy, and a mismatched opening balance is the single most common cause of a COGS number that will not tie out.
- Enter purchases (line 36) net of anything withdrawn for personal use, then cost of labour (line 37) for direct production staff only. Your own draw as a sole proprietor is not cost of labour, and neither are selling or administrative salaries — those belong in operating expenses further down the return.
- Enter materials and supplies (line 38) and other costs (line 39). Other costs is where containers, packaging, factory overhead and freight-in live, and it is also where any section 263A costs you are required to capitalise into inventory belong. Get that amount from your accountant; this page does not compute it.
- Enter closing inventory (line 41) valued on the method you actually use, or the COGS figure from your books if you are solving backwards. Note which valuation method you used and keep using it — switching between FIFO, LIFO and weighted average changes COGS and generally requires IRS consent.
- Read the ratio, not just the dollars. COGS as a percentage of revenue is what makes this period comparable to the last one and to your competitors. A rising ratio means input costs are outrunning your prices; the dollar figure alone will not show you that when volume is also moving.
The formula.
The calculator first sums Schedule C lines 35 through 39 into goods available for sale (line 40): beginning inventory plus purchases plus cost of labour plus materials and supplies plus other costs. In the forward direction it then subtracts closing inventory to give cost of goods sold (line 42). In the backward direction it subtracts your known cost of goods sold from the same total to give the closing inventory that figure implies. The two directions are the same equation rearranged, which is why running one and feeding the result into the other returns your starting figure exactly.
Gross profit is net sales minus cost of goods sold, and COGS as a percentage of revenue is cost of goods sold divided by net sales times 100. That percentage and gross margin always sum to exactly 100%, so you can read either one off the other. Inventory change is closing minus opening inventory: positive means stock was built during the period, negative means it was drawn down.
Rounding stage: nothing is rounded part-way through. Every addition, subtraction and division is carried at full decimal precision and rounded exactly once, at the point the result is returned, to ten decimal places; the currency and percentage formatting on screen is applied afterwards by the page. A COGS of $100 against $300 of revenue therefore reports 33.3333333333%, not a prematurely truncated 33.33% that would stop gross margin and the COGS ratio summing to 100.
Using the worked example: beginning inventory $40,000 plus purchases $150,000 plus labour $30,000 plus materials $10,000 plus other costs $5,000 gives goods available for sale of $235,000. Closing inventory of $45,000 leaves cost of goods sold of $190,000. Against net sales of $400,000 that is a gross profit of $210,000 and a COGS ratio of 47.5%. Inventory change is $45,000 − $40,000 = +$5,000, meaning $5,000 of the period's purchasing went into stock rather than into cost.
Two states are rejected rather than returned, because both would produce a plausible-looking number that is arithmetically impossible. Closing inventory greater than goods available for sale would make cost of goods sold negative; a known COGS greater than goods available for sale would imply negative closing inventory. In each case the calculator names the field and shows you both figures so you can see which one is wrong.
A worked example.
A small furniture maker files Schedule C. On 1 January it is holding $40,000 of timber, hardware and finished pieces. Over the year it buys $150,000 of materials and stock, pays $30,000 to the two people who actually build the furniture, spends $10,000 on consumable materials and supplies, and $5,000 on packaging, crating and freight-in. Net sales for the year are $400,000. The physical count on 31 December values closing inventory at $45,000. Goods available for sale is $40,000 + $150,000 + $30,000 + $10,000 + $5,000 = $235,000 — Schedule C line 40. Subtracting the $45,000 still on the floor gives cost of goods sold of $190,000, line 42. Gross profit is $400,000 − $190,000 = $210,000, and COGS is 47.5% of revenue. Inventory change is $45,000 − $40,000 = +$5,000: the business ended the year holding $5,000 more stock than it started with, so $5,000 of what it spent went onto the balance sheet rather than into the expense line. Notice what that does to the intuition. The business laid out $195,000 in cash across purchases, labour, materials and other costs, but only $190,000 of it is deductible as cost of goods sold this year. The missing $5,000 is not lost — it is sitting in closing inventory and will flow through cost of goods sold whenever those pieces are sold. Reading the bank statement instead of the inventory flow would have overstated the deduction by exactly that amount. Now run it backwards, which is the check worth doing every year. Suppose the accounting system reports COGS of $190,000 but nobody has done a physical count. Solving for ending inventory gives $235,000 − $190,000 = $45,000. If the warehouse then counts $41,500 of stock, the $3,500 gap is real: shrinkage, breakage, a mispriced item, or a count that missed a pallet. The identity cannot tell you which, but it tells you the size of the question, and it is a question worth asking before the return is filed. One caveat that changes how this number should be read. All of the above assumes a single, consistent inventory valuation method. If the same $150,000 of purchases were costed out LIFO rather than FIFO in a year when timber prices rose, the newest and dearest units would land in cost of goods sold and the oldest and cheapest would stay in closing inventory — pushing COGS above $190,000 and gross profit below $210,000 from exactly the same transactions. LIFO is available to this US filer under IRS Publication 538. It would not be available to the same business reporting under IAS 2.
Frequently asked questions.
What is the cost of goods sold formula?
Why isn't COGS just what I spent on inventory this year?
How does FIFO, LIFO or weighted average change my COGS?
Do US tax rules and IFRS give the same COGS?
What are section 263A costs and do they belong in this calculator?
What is the difference between COGS and cost of services?
Is gross profit here the same as contribution margin?
Why does my beginning inventory have to match last year's closing figure?
What does it mean if my solved ending inventory is higher than my physical count?
Should freight and shipping go in COGS?
References& sources.
- [1]Internal Revenue Service, Publication 334 "Tax Guide for Small Business" — Cost of Goods Sold / Schedule C Part III, lines 35–42 (retrieved 2026-07-29). Primary source for the line structure and the inventory-flow identity implemented here: line 35 inventory at beginning of year, 36 purchases less items withdrawn for personal use, 37 cost of labor, 38 materials and supplies, 39 other costs, 40 the sum of 35–39, 41 inventory at end of year, 42 cost of goods sold. Open access.
- [2]Internal Revenue Service, Publication 538 "Accounting Periods and Methods" — Inventories (retrieved 2026-07-29). Source for the permitted inventory valuation bases (cost; lower of cost or market; retail) and cost-identification methods (specific identification, FIFO, LIFO), and for the statement that inventory value is "a major factor in figuring your taxable income". Open access.
- [3]IFRS Foundation, IAS 2 "Inventories" (retrieved 2026-07-29). Independent second authority. Source for "when inventories are sold, the carrying amount of those inventories is recognised as an expense in the period in which the related revenue is recognised", for cost comprising "all costs of purchase, costs of conversion (direct labour and production overhead) and other costs incurred in bringing the inventories to their present location and condition", and for the permitted cost formulas being FIFO and weighted average only — the basis of this page's disclosed US/IFRS conflict. Standard text itself is paywalled; the cited summary page is open.
- [4]17 CFR § 210.5-03 (Regulation S-X, Rule 5-03) "Income statements", line item 2 (retrieved 2026-07-29 via Cornell Legal Information Institute). Third independent authority: requires registrants to "State separately the amount of (a) cost of tangible goods sold, … (d) cost of services", which is this page's basis for distinguishing cost of goods sold from cost of services. Open access.
- [5]Internal Revenue Service, Form 1125-A "Cost of Goods Sold" (Rev. November 2024). The corporate and partnership form carrying the same eight-line structure as Schedule C Part III, including the separate line for additional section 263A costs. Official form PDF; open access.
- [6]OpenStax, Principles of Accounting, Volume 2: Managerial Accounting, §6.5 "Compare and Contrast Variable and Absorption Costing" (retrieved 2026-07-29). Source for the absorption-versus-variable costing distinction underpinning this page's "gross profit is not contribution margin" caveat. Open access.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 762 calculators remain free
- No billing is enabled