Background

FREE COST OF GOODS SOLD CALCULATOR

This COGS calculator determines the cost of goods sold by calculating direct production costs such as materials, labor, and inventory changes.

What is cost of goods sold (COGS)?

Cost of goods sold (COGS) is the total direct cost a company incurs to produce or purchase the goods it sells during a specific accounting period. It captures every expense directly tied to turning raw materials into finished products — including materials, direct labor, and manufacturing overhead — while excluding indirect costs like marketing, rent, and administrative salaries.

COGS is a critical line item on the income statement because it is subtracted from revenue to determine gross profit. A lower COGS relative to revenue means higher margins and more room for operating expenses, reinvestment, and profit.

The formula is:

COGS = Beginning Inventory + Purchases − Ending Inventory

For example, if a retailer starts the quarter with $50,000 in inventory, purchases $30,000 in new stock, and ends the quarter with $20,000 remaining, COGS is $50,000 + $30,000 − $20,000 = $60,000. That $60,000 represents the cost of the goods that were actually sold to customers.

How to use this COGS calculator

This calculator instantly computes cost of goods sold from three inputs. Follow these steps:

  1. Determine beginning inventory — find the total value of inventory on hand at the start of the period. This is usually the ending inventory from the previous period.
  2. Enter beginning inventory — type the dollar amount in the "Beginning Inventory" field.
  3. Calculate total purchases — add up all inventory bought or produced during the period, including raw materials, freight-in, and direct labor costs.
  4. Enter purchases — type the total in the "Purchases" field.
  5. Determine ending inventory — count and value all inventory remaining at the end of the period using your chosen valuation method (FIFO, LIFO, or weighted average).
  6. Enter ending inventory — type the dollar amount in the "Ending Inventory" field.
  7. Read the result — the cost of goods sold appears instantly below the inputs.

Key features

Instant calculation
Results update in real time as you type — no "calculate" button needed.
Edge-case handling
COGS is clamped to zero if the formula yields a negative value (ending inventory exceeds beginning inventory plus purchases). Invalid and negative inputs are blocked at the keyboard level.
Input validation
All three fields accept values from $0 to $999,999,999 with two decimal places. Invalid characters (e, E, +, -) are blocked.
Local storage persistence
Your inputs are saved automatically in the browser so you can close the tab and return later.
No sign-up required
100% free, runs entirely in your browser, and never asks for an email address or credit card.

Worked examples

The table below shows COGS calculations across different business scenarios:

ScenarioBeginning inventoryPurchasesEnding inventoryCOGS
Small bakery$2,000$5,000$1,500$5,500
Online retailer$25,000$40,000$15,000$50,000
Clothing store$80,000$120,000$60,000$140,000
Electronics distributor$200,000$350,000$180,000$370,000
Manufacturing plant$500,000$1,200,000$450,000$1,250,000

What is included in COGS vs. operating expenses?

Included in COGSNot included (operating expenses)
Raw materials and suppliesOffice rent and utilities
Direct labor (factory workers)Sales and marketing expenses
Manufacturing overheadAdministrative salaries
Freight-in and shipping to warehouseShipping to customers (distribution)
Factory equipment depreciationOffice equipment depreciation
Packaging materialsLegal and accounting fees

Gross Profit = Revenue − COGS. Then, Operating Profit = Gross Profit − Operating Expenses. Keeping these categories separate gives you a clearer picture of where your business makes and spends money.

Inventory valuation methods and their impact on COGS

The method you use to value inventory directly affects your COGS figure and reported profit:

FIFO (First In, First Out)
Assumes the oldest inventory is sold first. When prices are rising, FIFO produces lower COGS and higher gross profit because the cheaper, earlier-purchased items are expensed first.
LIFO (Last In, First Out)
Assumes the newest inventory is sold first. When prices are rising, LIFO produces higher COGS and lower gross profit, which can reduce taxable income. LIFO is allowed under U.S. GAAP but not under IFRS.
Weighted Average Cost
Calculates an average cost per unit across all inventory available for sale during the period. COGS falls between FIFO and LIFO values, smoothing out price fluctuations.

Why tracking COGS matters

  • Gross profit analysis — COGS is subtracted from revenue to calculate gross profit, the starting point for understanding profitability.
  • Pricing decisions — knowing the direct cost of goods helps you set prices that cover production costs and deliver target margins.
  • Tax reporting — COGS is a deductible expense that reduces taxable income. Accurate tracking ensures you claim the correct deduction.
  • Inventory management — comparing beginning and ending inventory alongside COGS reveals how efficiently you turn stock into sales.
  • Financial statements — lenders, investors, and stakeholders rely on accurate COGS to evaluate your company's cost efficiency and operational health.
  • Trend analysis — tracking COGS over time helps you spot rising material costs, production inefficiencies, or favorable purchasing trends.

How to reduce COGS

  • Negotiate supplier pricing — leverage volume discounts, long-term contracts, or alternative vendors to lower material costs.
  • Improve production efficiency — reduce waste, streamline workflows, and invest in automation to lower direct labor and overhead costs.
  • Optimize inventory levels — avoid overstocking (which ties up capital) and understocking (which leads to rush orders at premium prices).
  • Reduce shrinkage and spoilage — implement better storage, handling, and security measures to minimize inventory losses.
  • Source strategically — consider alternative materials, nearshoring, or group purchasing organizations to reduce procurement costs.

Who benefits from calculating COGS?

  • Retailers and e-commerce sellers — track the true cost of goods sold to set competitive prices and maintain healthy margins.
  • Manufacturers — monitor production costs including materials, labor, and overhead to identify savings opportunities.
  • Accountants and bookkeepers — prepare accurate income statements and tax returns with correct COGS figures.
  • Small business owners — understand which products are most profitable and make informed stocking decisions.
  • Financial analysts — evaluate company performance by comparing COGS trends, gross margins, and inventory turnover ratios.
  • Students and educators — learn and teach core accounting concepts with a hands-on tool.

Helpful resources

Other free tools you might find useful

Estimate true employee costs with the Labor Cost Calculator, calculate fixed cost per unit with the Average Fixed Cost Calculator, or analyze margins with the Contribution Margin Calculator.

Track costs with ShiftFlow

ShiftFlow helps you track hours, manage schedules, and understand your true labor costs. Accurate time tracking feeds directly into cost calculations — giving you clearer insight into COGS, operational efficiency, and profitability. Start a free trial today.

Cost of goods sold calculator FAQ

What is cost of goods sold (COGS)?

COGS is the total direct cost of producing or purchasing the goods a company sells during a period. It includes raw materials, direct labor, and manufacturing overhead. COGS is subtracted from revenue to determine gross profit.

How do I calculate COGS?

Use the formula: COGS = Beginning Inventory + Purchases − Ending Inventory. For example, $1,000 beginning inventory + $500 purchases − $1,000 ending inventory = $500 in cost of goods sold.

Is this calculator free?

Yes. This calculator is 100% free, requires no sign-up, and runs entirely in your browser. Your inputs are saved to local storage so you can return later without re-entering data.

Can COGS be negative?

No. COGS represents real costs incurred, so it is always zero or positive. If the formula yields a negative number, it usually indicates a data error. This calculator clamps the result to zero in such cases.

What components are included in COGS?

COGS includes raw materials, direct labor, manufacturing overhead, freight-in costs, and packaging materials — any cost directly tied to producing the product. It excludes marketing, office rent, admin salaries, and distribution costs.

What is the difference between COGS and operating expenses?

COGS covers only direct production costs. Operating expenses (OPEX) cover all other costs of running the business — rent, utilities, marketing, and administrative salaries. Gross Profit = Revenue − COGS, and Operating Profit = Gross Profit − OPEX.

Why is COGS important?

COGS directly determines gross profit margin, helps set competitive prices, is a deductible expense for tax purposes, reveals inventory management efficiency, and provides key data for financial reporting and trend analysis.

What inventory valuation methods affect COGS?

FIFO (First In, First Out) uses oldest costs first — lower COGS when prices rise. LIFO (Last In, First Out) uses newest costs first — higher COGS when prices rise. Weighted Average blends all costs evenly. Each method produces different COGS and profit figures.

What is the COGS if beginning inventory is $1,000, purchases are $500, and ending inventory is $1,000?

COGS = $1,000 + $500 − $1,000 = $500. The company spent $500 on the goods it actually sold during that period.

Knowing the cost of goods sold is essential for analyzing gross
profit, pricing products, and managing inventory efficiently.

With Shiftflow, COGS calculations support financial analysis and operational planning, giving
businesses clearer insight into production costs.

START FREE TRIAL

SIGN UP NOW
WE CAN HELP YOU SAVE

47% less

time spent on administrative tasks

12% saved

on total payroll budget

5+ hours

reclaimed by managers weekly

4.8/5
— based on 10,000+ trusted reviews
START MY 14-DAY FREE TRIAL