COGS Calculator

Calculate Cost of Goods Sold — Manufacturer, Retailer and Service Business Formula

Calculate COGS using beginning inventory, purchases & ending inventory. Includes FIFO vs LIFO, inventory turnover & industry benchmarks | Calculator4U

Calculate COGS for inventory and profitability analysis.

About This Calculator

The Cost of Goods Sold (COGS) Calculator is an essential financial tool for businesses that manufacture or resell products. COGS represents the direct costs attributable to producing the goods a company sells during a specific accounting period. Understanding and accurately calculating COGS is fundamental to determining gross profit, setting competitive prices, and making informed inventory management decisions.

In financial accounting, COGS is one of the most critical line items on the income statement. It directly impacts your gross margin—the primary indicator of how efficiently your business converts raw materials and labor into sellable products. For manufacturers, retailers, and wholesalers, COGS tracking is required by Generally Accepted Accounting Principles (GAAP) and the IRS for proper tax reporting.

This calculator helps you compute COGS by accounting for beginning inventory, purchases made during the period, direct labor costs, manufacturing overhead, and ending inventory. Use it to analyze profitability, compare periods, and optimize your inventory turnover for better cash flow management.

The COGS Formula

COGS = Beginning Inventory + Purchases + Direct Labor + Manufacturing Overhead - Ending Inventory

Beginning Inventory = Value of unsold inventory at the start of the period

Purchases = Cost of raw materials or merchandise acquired during the period

Direct Labor = Wages paid to workers directly producing goods

Manufacturing Overhead = Indirect production costs (factory utilities, depreciation)

Ending Inventory = Value of unsold inventory at the end of the period

For retailers, a simplified formula is often used: COGS = Beginning Inventory + Purchases - Ending Inventory

COGS Components Breakdown

What counts as a direct cost included in COGS:

ComponentDescriptionExamples
Direct MaterialsRaw materials used in productionSteel, fabric, electronic components, packaging
Direct LaborWages for production workersAssembly line workers, machine operators
Manufacturing OverheadIndirect production costsFactory rent, utilities, equipment depreciation
Freight-InShipping costs for materialsDelivery charges to bring materials to factory
Purchase DiscountsReductions from suppliers (subtracted)Early payment discounts, volume discounts

COGS vs. Operating Expenses

Understanding what belongs in COGS versus operating expenses is crucial for accurate financial reporting:

COGS (Direct Costs)Operating Expenses (Indirect Costs)
Raw materials and componentsSales commissions and advertising
Production worker wagesAdministrative salaries
Factory rent and utilitiesOffice rent and utilities
Manufacturing equipment depreciationOffice equipment and software
Quality control in productionLegal and accounting fees

Key distinction: COGS represents costs that would not exist without production. Operating expenses are incurred regardless of production volume.

How to Use This COGS Calculator

  1. Enter beginning inventory: The value of inventory on hand at the start of your accounting period from your balance sheet.
  2. Input purchases: Total cost of raw materials, merchandise, or components purchased during the period.
  3. Add direct labor: Wages paid to workers directly involved in manufacturing or assembling products.
  4. Include manufacturing overhead: Factory costs like rent, utilities, equipment depreciation, and production supplies.
  5. Enter ending inventory: Value of unsold inventory at period end, determined by physical count or perpetual system.
  6. Add total revenue: Sales revenue for the period to calculate gross margin and related ratios.
  7. Review results: Analyze COGS, gross profit, gross margin percentage, and inventory turnover metrics.

Common COGS Calculation Mistakes to Avoid

❌ Including operating expenses in COGS: Marketing, sales commissions, and administrative costs belong on the income statement below gross profit, not in COGS. Including them overstates COGS and understates gross margin.

❌ Inconsistent inventory valuation: Switching between FIFO, LIFO, or weighted average methods between periods violates GAAP consistency principles and distorts trend analysis.

❌ Forgetting freight-in costs: Shipping costs to receive inventory should be included in COGS, while freight-out (delivery to customers) is a selling expense.

❌ Inaccurate physical inventory counts: Shrinkage, obsolescence, and counting errors affect ending inventory and therefore COGS accuracy. Conduct regular cycle counts.

❌ Omitting manufacturing overhead: For manufacturers, only including materials and ignoring factory overhead understates true production costs and overstates gross margin.

Inventory Valuation Methods

The method you choose affects reported COGS and net income:

MethodDescriptionBest ForTax Impact
FIFOFirst-In, First-Out: oldest inventory sold firstPerishable goods, rising pricesLower COGS, higher taxes in inflation
LIFOLast-In, First-Out: newest inventory sold firstTax minimization (US only)Higher COGS, lower taxes in inflation
Weighted AverageAverage cost of all units availableHomogeneous products, stable pricesModerate COGS, balanced approach

Note: LIFO is not permitted under IFRS and is primarily used in the United States. Once a method is selected, consistency is required.

Related Financial Calculators

Sources & Methodology: COGS calculations follow Generally Accepted Accounting Principles (GAAP) as defined by the Financial Accounting Standards Board (FASB) ASC 330 for inventory accounting. Inventory valuation methods comply with IRS Publication 538 for US tax purposes. For international businesses, IFRS (IAS 2) standards apply, noting that LIFO is prohibited under IFRS. Always consult with a qualified accountant for business-specific guidance. Calculator updated January 2026.

Frequently Asked Questions

What is the COGS formula and how is it calculated step by step?

Retailer COGS = Beginning Inventory + Purchases − Ending Inventory. Manufacturer COGS = Beginning Inventory + Purchases + Direct Labor + Manufacturing Overhead − Ending Inventory. Retailer example: beginning inventory $20,000 + purchases $60,000 − ending inventory $18,000 = COGS $62,000. Revenue $100,000. Gross Profit = $38,000. Gross Margin = 38%. Manufacturer example: beginning inventory $15,000 + purchases $50,000 + direct labor $18,000 + overhead $9,000 − ending inventory $12,000 = COGS $80,000. Revenue $130,000. Gross Profit = $50,000. Gross Margin = 38.5%. COGS excludes all selling, general and administrative expenses — those appear below gross profit on the income statement.

What is the difference between FIFO and LIFO for calculating COGS?

FIFO (First In, First Out) sells oldest inventory first. LIFO (Last In, First Out) sells newest inventory first. Both are legal under US GAAP. LIFO is prohibited under IFRS. Numeric example — 3 purchase batches: 100 units at $10 (Batch 1), 100 units at $12 (Batch 2), 100 units at $15 (Batch 3). Sell 150 units. FIFO COGS: 100×$10 + 50×$12 = $1,600. LIFO COGS: 100×$15 + 50×$12 = $2,100. FIFO ending inventory value: $1,950. LIFO ending inventory value: $1,450. In rising prices, LIFO produces $500 more in COGS — reducing taxable income by $500 and saving approximately $105 in taxes at 21% corporate rate. FIFO shows higher gross profit, which improves the balance sheet and investor perception but increases tax liability.

How does COGS affect gross profit and taxes?

Gross Profit = Revenue − COGS. Every $1 increase in valid COGS reduces gross profit by $1 and reduces taxable income by $1. At 21% federal corporate tax rate, $10,000 more in legitimate COGS saves $2,100 in taxes. For a business with $500,000 revenue and $300,000 COGS: gross profit = $200,000, gross margin = 40%. If COGS rises to $350,000: gross margin falls to 30%, taxable income drops by $50,000, saving $10,500 in taxes. The IRS requires businesses with average gross receipts above $27 million (2024 threshold) to use accrual accounting for inventory — they cannot use cash-basis COGS. Smaller businesses may use simplified methods under IRS Notice 2001-76.

How do you calculate COGS for a service business?

Service businesses do not carry physical inventory but still have a Cost of Services (sometimes reported as COGS on the income statement). Service COGS includes: direct labour costs of employees delivering the service (not management or admin), subcontractor and freelancer costs for service delivery, direct software and tools used exclusively for client delivery, and direct materials consumed in service provision. Example — IT consulting firm: revenue $500,000. Direct labour (consultants' salaries) $180,000 + subcontractors $60,000 + direct software licences $15,000 = Service COGS $255,000. Gross Profit = $245,000. Gross Margin = 49%. Excluded from service COGS: sales team salaries, office rent, accounting, management overhead — these are operating expenses. The IRS and GAAP recognise service costs as COGS when they are directly attributable to generating specific service revenue.

How do you calculate inventory turnover ratio from COGS?

Inventory Turnover Ratio = COGS ÷ Average Inventory. Average Inventory = (Beginning Inventory + Ending Inventory) ÷ 2. Example: COGS $300,000. Beginning inventory $40,000, ending inventory $60,000. Average inventory = $50,000. Inventory Turnover = $300,000 ÷ $50,000 = 6×. This means inventory is sold and replaced 6 times per year. Days Inventory Outstanding (DIO) = 365 ÷ Inventory Turnover = 365 ÷ 6 = 61 days. Industry benchmarks: grocery retail 20-30× (12-18 days). General retail 4-8× (45-90 days). Manufacturing 4-6× (60-90 days). High turnover = efficient inventory management. Low turnover = slow-moving stock, tied-up cash, potential obsolescence risk.

Can COGS be negative and what does it mean?

No — COGS cannot be negative under normal circumstances. COGS represents real production costs, which are always positive or zero. A negative COGS calculation almost always signals a data entry error: ending inventory entered as larger than beginning inventory plus purchases (mathematically impossible in a real period), or costs entered with the wrong sign. One rare exception: vendor rebates or purchase price adjustments received after the period end can reduce COGS retroactively, but accounting standards require these to be applied to reduce inventory cost first and then COGS — the result approaches zero but should not go negative. If your COGS calculator returns a negative number, check that your ending inventory does not exceed your beginning inventory plus all purchases made during the period.

What is a good COGS percentage of revenue by industry?

COGS as a percentage of revenue (i.e., 100% minus gross margin) varies significantly by sector. Grocery and food retail: 70-80% COGS (20-30% gross margin) — high volume, thin margins. General retail/e-commerce: 50-65% COGS (35-50% gross margin). Manufacturing: 50-70% COGS (30-50% gross margin). Restaurants: 28-35% food/beverage COGS (65-72% gross margin, before labour overhead). Software/SaaS: 10-25% COGS (75-90% gross margin) — primarily hosting and support costs. Healthcare services: 40-60% COGS. Professional services: 20-40% COGS (direct labour only). Use these benchmarks to assess whether your COGS percentage is competitive. A COGS percentage rising year-over-year while revenue grows signals cost inflation, supplier pricing pressure, or production inefficiency — each requiring a different response.