COGS Calculator
Calculate cost of goods sold free: beginning inventory + purchases + direct expenses − ending inventory. Enter your figures and this calculator instantly shows COGS, gross profit and margin, and COGS per unit.
COGS Calculator
Cost of goods sold in seconds — beginning inventory plus purchases minus ending inventory, with gross profit, margin and per-unit cost. Free, private, no signup.
100% private — every calculation happens in your browser. Nothing is uploaded or stored.
How to use
- Enter beginning inventory, purchases during the period, direct expenses, and ending inventory — the defaults are $12,000, $8,000, $1,500, and $6,000.
- Add revenue for the period and units sold if you want gross profit, margin, and COGS per unit — the defaults are $30,000 and 1,000 units.
- Read COGS, goods available for sale, gross profit, margin, and COGS per unit instantly as you type — there is no button to press.
- Check the warning note if COGS comes out negative: ending inventory cannot exceed everything available for sale.
How the cogs formula works
The cogs formula is straightforward, but each input has to be measured over the same period. Start with the inventory you held at the beginning of the period, add everything you bought or produced during that period, add direct expenses such as labour, freight in, and packaging, and then subtract the inventory still on hand at the end. What remains is the cost of the goods you actually sold. For a simple cost of goods sold example, take $12,000 of beginning inventory plus $8,000 of purchases plus $1,500 of direct expenses, which gives $21,500 of goods available for sale. Subtract $6,000 of ending inventory and you get $15,500 of COGS. That figure is the starting point for gross profit: subtract it from revenue to see what is left after the direct cost of what you sold. Because the calculator updates instantly, you can change any input and watch COGS, profit, and margin move together, which makes it easy to check a month, a quarter, or a full year without rebuilding a spreadsheet. Keep the period consistent, count only stock that belongs to that period, and record purchases when they arrive rather than when they are paid for, so the formula reflects goods available rather than cash flow.
What is included in COGS, and what is not
Understanding what is included in cogs matters as much as the arithmetic, because the same business can report very different COGS figures if it counts the wrong costs. COGS includes the direct costs of producing or buying the goods you sold: raw materials, components, direct labour on production, freight in, packaging that travels with the product, and the cost of goods bought for resale. It does not include the costs of running the business in general, which is the heart of cogs vs operating expenses. Rent, marketing, salaries for administration, software subscriptions, office supplies, and interest are operating expenses, not COGS, even though they reduce profit later in the accounts. Including them in COGS would understate gross profit and distort margin, while leaving genuine direct costs out would overstate gross profit and make pricing look safer than it is. The distinction also matters for tax and reporting, because COGS is usually deducted from revenue before operating expenses, and different rules apply to inventory valuation. If a cost would disappear if you stopped selling that product, it is probably a direct cost; if it would continue while the business idles, it is probably an operating expense. Use that test when you are unsure, and keep a consistent list from period to period so comparisons remain meaningful.
COGS, gross profit, margin, and per-unit cost in one view
Most free COGS tools show only the single COGS number, but this calculator adds gross profit and margin and COGS per unit in one view, with a goods-available-for-sale breakdown. With the default figures, goods available for sale are $21,500, COGS is $15,500, revenue of $30,000 leaves gross profit of $14,500, and gross margin is 48.3 percent. COGS per unit is $15.50 on 1,000 units sold, and COGS takes 51.7 percent of revenue. Those extra figures turn a cost total into a pricing and profitability check. Gross profit shows how much revenue remains to cover operating expenses, rent, marketing, and tax, while margin shows that cushion as a percentage, so you can compare products or periods with different revenue levels. COGS per unit is especially useful for pricing: if your selling price is below COGS per unit, every sale loses money before any other cost is counted, and if it is only slightly above, a small cost increase can wipe out the margin. Use the calculator to test scenarios — higher purchase prices, a larger ending inventory count, or a price change — and see immediately whether gross profit still covers the rest of the business. That makes COGS not just a reporting figure, but a practical tool for deciding what to charge and what to stock.
Formats, limits, and safe use
This calculator is designed for a single period and a single set of inventory figures, so it works best when you enter one period at a time and keep the same valuation method throughout. It accepts decimal amounts for money and whole numbers for units, and it treats blank revenue or units fields as missing rather than zero, so gross profit, margin, or per-unit cost show as a dash until you enter a value. A negative COGS result is a warning, not a valid answer: it means ending inventory exceeds goods available for sale, which usually points to a counting error, a purchase recorded in the wrong period, or direct expenses double-counted. The calculator does not apply inventory valuation methods such as FIFO or weighted average, does not split COGS across product lines, and does not include VAT, sales tax, or overhead allocation, so use it for quick checks and planning rather than as a substitute for accounting records. For formal accounts, reconcile the figures with stock counts, supplier invoices, and your accounting system, and keep the same period boundaries each time. All calculations happen in your browser, so no figures are uploaded or stored, and you can reuse the tool for as many periods as you like without signing up.
Cost of goods sold is the direct cost of the goods a business sold during a period, including materials, direct labour, and the cost of goods bought for resale. It is subtracted from revenue to give gross profit, and it shows how much of each sale was consumed by producing or acquiring what was sold.
The COGS formula is beginning inventory plus purchases plus direct expenses minus ending inventory. For example, $12,000 of beginning inventory plus $8,000 of purchases plus $1,500 of direct expenses gives $21,500 available for sale, and subtracting $6,000 of ending inventory gives COGS of $15,500.
COGS includes direct costs such as raw materials, direct labour, freight in, and packaging, as well as goods bought for resale. It does not include operating expenses such as rent, marketing, administration, or interest, which are deducted after gross profit. Keeping that distinction clear is essential for an accurate gross margin.
COGS directly reduces gross profit, so a higher COGS leaves less revenue to cover operating expenses and profit. COGS per unit also sets a floor for pricing: a selling price below COGS per unit loses money on every sale. Tracking COGS and margin together helps you set prices that cover direct costs and still leave room for the rest of the business.
Related tools: ROAS Calculator, Print on Demand Profit Calculator, and Barcode Generator.