Home › Calculators › Cost of Goods Sold Calculator

Cost of Goods Sold Calculator

Calculate cost of goods sold with the periodic inventory formula: beginning inventory plus purchases and direct costs, minus ending inventory. Add your revenue to also see gross profit, gross margin and how fast your inventory turns.

Last updated:

Inventory
$
$

Value of stock on hand at the end of the period.

Purchases
$
$
$

Subtracted from purchases.

Direct production costs (optional)
$
$

Factory overhead, packaging, other costs to produce.

Sales (optional)
$

Leave empty to skip gross profit.

365 for a year, 90 for a quarter, 30 for a month.

Enter your values to see the result.
Advertisement
Advertisement

How to use the Cost of Goods Sold Calculator

  1. Enter beginning inventory: the value of inventory on hand at the start of the period (last period's ending inventory).
  2. Add purchases and freight-in, and subtract purchase returns and discounts.
  3. Add direct labor and other direct costs if you manufacture or assemble products.
  4. Enter ending inventory from your stock count at the end of the period.
  5. Optionally enter revenue to see gross profit, gross margin and inventory turnover.

The cost of goods sold formula

COGS = Beginning inventory + Net purchases + Direct costs − Ending inventory

  • Net purchases = purchases + freight-in − purchase returns and allowances − purchase discounts.
  • Direct costs (manufacturers): direct labor and manufacturing overhead used to make the goods.
  • Goods available for sale = beginning inventory + net purchases + direct costs. Part of it was sold (COGS) and the rest is still on the shelf (ending inventory).
  • Gross profit = revenue − COGS, and gross margin = gross profit ÷ revenue.

Example: $25,000 beginning inventory + $81,500 net purchases ($80,000 + $3,000 freight-in − $1,500 returns) + $12,000 direct labor + $6,000 overhead = $124,500 available. With $30,000 left at year end, COGS = $94,500. On $160,000 of revenue, gross profit is $65,500, a 40.9% gross margin.

What goes into COGS and what does not

Included in COGSUsually not in COGS (operating expenses)
Purchase price of goods for resaleRent for offices and retail space
Raw materials and componentsMarketing and advertising
Inbound freight and import dutiesSales salaries and commissions
Direct labor of production workersAdministrative and office salaries
Factory overhead (utilities, equipment depreciation)Interest and income taxes
Packaging that is part of the productGeneral software, insurance, legal fees

Service businesses often report "cost of revenue" or "cost of services" instead, made up of the direct labor and materials needed to deliver the service.

FIFO, LIFO and weighted average

When unit costs change during the year, the inventory method decides which costs stay in ending inventory. Under FIFO the oldest costs go to COGS first; under LIFO (allowed under US GAAP, not under IFRS) the newest costs go first; weighted average uses the average cost of all units available. Value your ending inventory with your chosen method and enter it here.

Frequently asked questions

What is the COGS formula?

Cost of goods sold = beginning inventory + purchases − ending inventory. Freight-in is added to purchases, purchase returns and discounts are subtracted, and manufacturers also add direct labor and manufacturing overhead. The result is the cost of the inventory that was actually sold during the period.

What costs are included in COGS?

COGS includes the direct cost of products sold: the purchase price of goods or raw materials, inbound freight, direct labor to make the product and manufacturing overhead such as factory utilities. It excludes selling, marketing, administrative costs, outbound shipping in many cases, and interest, which are operating or non-operating expenses.

Why can COGS not be negative?

If ending inventory is larger than everything available for sale (beginning inventory + purchases + direct costs), the numbers do not reconcile. Usually a purchase is missing, ending inventory was over-counted, or the periods do not match.

How do I calculate gross profit and gross margin from COGS?

Gross profit = revenue − COGS. Gross margin = gross profit ÷ revenue × 100. With revenue of $160,000 and COGS of $94,500, gross profit is $65,500 and the gross margin is about 40.9%.

Does the inventory method (FIFO, LIFO, average) change COGS?

Yes. The method decides how ending inventory is valued when prices change. In a period of rising prices, FIFO leaves the newest, more expensive units in ending inventory, so COGS is lower; LIFO does the opposite. This calculator takes your ending inventory value as given, whichever method you use.

What is inventory turnover?

Inventory turnover = COGS ÷ average inventory, where average inventory = (beginning + ending) ÷ 2. Days in inventory = days in the period ÷ turnover, the average number of days an item sits in stock before it is sold.

Is my data stored anywhere?

No. The calculation runs entirely in your browser and nothing is uploaded.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Profit Margin CalculatorGross margin, markup, cost or price: solve for any one, single or bulk.Inventory Turnover CalculatorInventory turnover ratio and days inventory outstanding from COGS or sales and average stock.Landed Cost CalculatorTotal landed cost and cost per unit of imported goods, with duty, freight, fees and pricing.EBITDA CalculatorEBITDA, EBIT and EBITDA margin from net income or from revenue and operating expenses.Wholesale to Retail Price CalculatorSet wholesale price and MSRP from unit cost and margins, with an optional distributor tier.Receipt MakerFill in a receipt template with items and tax, then print or save PDF.Car Depreciation CalculatorEstimate your car's value over time and its projected resale price.CTR CalculatorCalculate click-through rate and compare it with industry benchmarks.Conversion Rate CalculatorCalculate e-commerce conversion rate, revenue per visitor and goals.CPM CalculatorSolve CPM, cost, impressions, CTR and CPC for ad campaigns.Quote Estimate GeneratorCreate a quote or estimate with line items and tax, then save as PDF.ROAS Calculator (Return on Ad Spend)Calculate ROAS, break-even ROAS and profit for each ad channel.Customer Lifetime Value CalculatorCalculate customer lifetime value, LTV:CAC ratio and CAC payback from ARPU and churn.Churn Rate CalculatorCalculate customer churn and retention rates and convert monthly churn to annual.YouTube Money CalculatorEstimate YouTube earnings per day, month and year from views and RPM by niche.Instagram Engagement Rate CalculatorCalculate Instagram engagement rate by followers or reach and compare it to benchmarks.Ecommerce Profit CalculatorNet profit, margin, markup and break-even ROAS per order after fees, ads and returns.Amazon FBA CalculatorEstimate Amazon FBA fees, profit per unit, margin, ROI and break-even price.Etsy Fee CalculatorEtsy listing, transaction, processing and Offsite Ads fees, payout and net profit.eBay Fee CalculatoreBay final value fee, per-order fee, ad fees, payout and net profit on any sale.Stock Profit CalculatorStock trade profit and % return after commissions, plus the break-even sell price.Dollar Cost Averaging CalculatorSee units bought, average cost, value and profit for regular buys at your own price list.Startup Runway CalculatorProject cash, burn rate and runway month by month, with growth, break-even and zero-cash date.Break Even CalculatorFind break-even units and revenue, contribution margin, margin of safety and a cost-volume chart.SaaS Pricing CalculatorModel flat, per-seat, tiered and volume plans with annual discounts to get MRR, ARR and ARPU.Employee Cost CalculatorWork out the true cost of an employee: payroll taxes, benefits, overhead and real hourly cost.Markup CalculatorFind the selling price from cost and markup, or the markup and margin from cost and price.Unit Price CalculatorCompare up to 4 products by price per ounce, pound, liter or item and find the best deal.Cap Rate CalculatorCalculate a rental property's NOI, cap rate and optional cash-on-cash return.Depreciation CalculatorStraight-line, declining balance, double declining and sum-of-years depreciation schedules.Crypto Profit CalculatorCalculate crypto trade profit, ROI and break-even price after buy and sell fees.PayPal Fee CalculatorWork out PayPal fees, what you receive, and how much to ask for to get an exact amount.Stripe Fee CalculatorCalculate Stripe fees and payouts, or how much to charge to receive an exact amount.Net Promoter Score CalculatorCalculate NPS from promoter, passive and detractor counts or pasted 0–10 survey scores.CPC CalculatorCalculate cost per click from ad spend and clicks, plus CPM, CTR, CPA and ROAS.P/E Ratio CalculatorPrice-to-earnings ratio, earnings yield and PEG ratio from share price, EPS and growth.WACC CalculatorWeighted average cost of capital from equity, debt, their costs and the tax rate.Payback Period CalculatorPayback and discounted payback period for an investment with even or uneven cash flows.Net Revenue Retention CalculatorNRR and GRR from expansion, contraction and churn, with annualized NRR for monthly data.Net Operating Income CalculatorNOI for rental property: rent, vacancy, other income and itemized expenses with expense ratio.Options Profit CalculatorProfit or loss at expiry for calls and puts, break-even, max profit/loss and a payoff chart.Poshmark Fee CalculatorPoshmark fee, earnings and profit, or the list price needed for your payout.Pre Money Post Money Valuation CalculatorPost-money valuation, investor and founder ownership and price per share for a funding round.Price Elasticity of Demand CalculatorFind the price elasticity of demand with the midpoint or simple method, plus revenue change.Freelance Project Price CalculatorTurn a task list with hours into a project quote with contingency, profit, tax and deposit.Rental Property Cash Flow CalculatorMonthly cash flow, NOI, cap rate, cash-on-cash return and the 1% rule for a rental property.Return on Assets CalculatorROA from net income and average total assets, plus operating ROA and adjusted ROA.Return on Equity CalculatorROE from net income and average equity, with a 3-step DuPont breakdown of what drives it.Rule of 40 CalculatorSaaS Rule of 40 score from revenue growth and profit margin, with pass/fail and the gap.Sales Funnel CalculatorCustomers, SQLs, MQLs, leads and visitors needed to hit a revenue goal.Shopify Fee CalculatorShopify fees by plan, payout, profit and margin, with third-party gateway fees.Solar Payback Period CalculatorSolar panel payback years, 25-year savings, ROI and cost per kWh with a cash-flow chart.Square Fee CalculatorSquare processing fees, net deposit and the price to cover fees by payment method.Tiered Pricing CalculatorPrice a quantity with tiers: total, per-tier breakdown and unit price, graduated or volume.Upwork Fee CalculatorUpwork service and withdrawal fees, net earnings, and what to bill for a target.Venmo Fee CalculatorVenmo fees for goods & services, instant transfers and card payments, plus reverse mode.Working Capital CalculatorNet working capital plus current, quick and cash ratios from your balance sheet.Ad Revenue CalculatorEstimate website ad earnings per day, month and year from pageviews and RPM, CPM or CPC.ACoS CalculatorCalculate ACoS, ROAS, break-even ACoS and target ACoS from ad spend, sales and margin.ARPU CalculatorCalculate average revenue per user or account, ARPPU and monthly vs. annual ARPU.Black-Scholes CalculatorPrice European call and put options with Black-Scholes, plus delta, gamma, theta, vega and rho.Cap Table CalculatorModel founders, option pool, SAFEs and priced rounds and see fully diluted ownership after each round.Cart Abandonment Rate CalculatorFind your cart abandonment rate, revenue lost in abandoned carts and what recovery wins back.Cash Flow Forecast CalculatorBuild a 13-week or 12-month cash flow forecast and spot your lowest cash balance before it hits.Crypto Price by Market Cap CalculatorPrice a coin would reach at a target market cap or at another coin's market cap.Current Ratio CalculatorCurrent assets ÷ current liabilities with interpretation, working capital and target solver.Day Rate CalculatorContractor or consultant day rate from income, benefits, expenses and billable days.ESPP CalculatorEmployee stock purchase plan gain: discount, lookback, shares, return and how a sale is taxed.
See all 209 Business & Marketing Calculators →