COGS Calculator

Calculate cost of goods sold and gross margin

Educational purposes only. This calculator is for informational purposes and should not be considered financial, tax, or legal advice. Consult a qualified professional for personalized guidance.

Try an example:

Enter inventory and cost data to calculate COGS

How This Tool Works

COGS Calculator

Understanding the True Cost of Your Products

Cost of Goods Sold represents one of the most critical numbers in any product-based business. This figure captures every dollar spent directly on creating or acquiring the items you sell, from raw materials to the labor that transforms them into finished products. The COGS calculator helps businesses accurately compute this fundamental metric, revealing the true cost foundation upon which all pricing and profitability decisions rest.

Getting COGS right matters because it directly determines gross profit and gross margin. Underestimate COGS and you might think you are profitable when you are actually losing money on every sale. Overestimate it and you might price yourself out of the market or miss opportunities for growth. Accurate COGS calculation provides the foundation for sound business decisions.

The calculator walks through each component of direct costs, helping ensure nothing is overlooked while avoiding the common mistake of including indirect expenses that belong elsewhere in financial statements.

The COGS Formula Explained

The fundamental COGS formula follows inventory through the accounting period:

COGS = Beginning Inventory + Purchases - Ending Inventory

This formula captures the flow of goods: you start with what you had, add what you bought or made, and subtract what remains. The difference represents what was sold during the period.

For manufacturing businesses, the formula expands to include production costs. Beginning inventory plus all production inputs (raw materials, direct labor, manufacturing overhead, and freight-in) minus ending inventory equals COGS. A manufacturer starting the year with $50,000 in inventory, purchasing $120,000 in materials, spending $45,000 on direct labor, $25,000 on manufacturing overhead, and $5,000 on inbound freight, while ending with $40,000 in inventory, would calculate COGS as $205,000.

The calculator handles both retail and manufacturing scenarios, accepting whatever cost components apply to your business model.

Direct Costs vs Period Costs

Understanding what belongs in COGS versus what counts as operating expenses prevents costly accounting errors. COGS includes only costs directly attributable to producing goods that were actually sold during the period.

Direct costs include raw materials and components that become part of finished products. They include manufacturing labor wages paid to workers who physically create products. Factory overhead directly tied to production qualifies, including equipment depreciation, factory utilities, and production supplies. Freight-in costs for shipping materials to your location belong in COGS as well.

Period costs do not belong in COGS even though they are necessary business expenses. Sales and marketing expenses happen regardless of production volume. Administrative salaries support the business but do not directly create products. Office rent and utilities are overhead costs unrelated to manufacturing. Distribution costs for shipping products to customers occur after production ends. Research and development investments prepare for future products rather than current production.

The calculator accepts only direct cost inputs, helping maintain this important distinction.

Inventory Valuation Methods

How you value inventory affects COGS significantly, especially when costs fluctuate. Three primary methods exist, each with different implications.

FIFO (First In, First Out) assumes the oldest inventory sells first. During inflationary periods, this means lower costs flow to COGS since you are valuing sold goods at older, lower prices. The result is higher reported profits and higher taxes. Remaining inventory reflects more recent, higher costs.

LIFO (Last In, First Out) assumes the newest inventory sells first. During inflation, this pushes higher recent costs into COGS, reducing reported profits and tax liability. Remaining inventory may be valued at costs from years ago, potentially understating balance sheet values. LIFO is permitted under US GAAP but not under IFRS.

Weighted Average Cost calculates a running average cost across all inventory. This smooths out price fluctuations and sits between FIFO and LIFO in its effects on reported profits during inflationary or deflationary periods.

The method you choose must be applied consistently and disclosed in financial statements. The calculator produces COGS figures that work with any inventory valuation method you use.

Calculating Gross Profit and Margin

Once COGS is determined, calculating gross profit becomes straightforward:

Gross Profit = Revenue - COGS

Gross margin expresses this as a percentage:

Gross Margin = (Gross Profit / Revenue) x 100

A company with $350,000 in revenue and $205,000 in COGS generates $145,000 in gross profit, representing a 41.4% gross margin. This means $0.41 of every revenue dollar remains after covering direct production costs.

Gross margin varies dramatically across industries. Grocery retailers typically operate on 1-3% gross margins due to commodity products and intense competition. Software companies often achieve 70-90% gross margins since digital products have minimal marginal costs. Manufacturing businesses commonly see 30-50% margins depending on their products and efficiency. Restaurant gross margins on food typically run 60-70%, though this excludes substantial labor costs that push net margins much lower.

The calculator displays gross margin alongside COGS when revenue is entered, providing immediate context for your cost structure.

Practical Applications in Business

Pricing decisions depend heavily on understanding COGS. Knowing the direct cost per unit establishes a floor below which prices cannot sustainably go. Target margins can then be applied to determine selling prices. If COGS per unit is $60 and target gross margin is 40%, the minimum selling price becomes $100 ($60 / 0.60).

Inventory management benefits from COGS analysis. Tracking how quickly inventory converts to COGS reveals turnover rates. Slow-moving inventory ties up capital and risks obsolescence. Fast-moving inventory might warrant larger purchases to capture volume discounts.

Supplier negotiations gain leverage from detailed COGS understanding. Knowing exactly what raw materials contribute to total costs identifies where price reductions would have the greatest impact. A 5% reduction on a component representing 40% of COGS saves more than a 10% reduction on a component representing 10%.

Production efficiency improvements target the largest COGS components. If direct labor dominates costs, automation investments might yield significant returns. If materials drive costs, engineering designs to reduce material requirements or waste could improve margins.

Common COGS Calculation Mistakes

Several errors frequently distort COGS calculations. Including indirect overhead inflates COGS and understates operating expenses, distorting both gross and operating margins. Administrative salaries, general insurance, and corporate overhead do not belong in COGS.

Ignoring beginning and ending inventory creates inaccurate period matching. Simply totaling purchases misses the crucial adjustment for inventory changes. A company that buys $100,000 in materials but uses only $80,000 (with $20,000 going to inventory) would overstate COGS by $20,000 without proper inventory accounting.

Forgetting freight-in costs understates COGS. Shipping materials to your production facility is a direct cost of acquiring inventory, distinct from freight-out costs to deliver finished products to customers.

Mixing inventory valuation methods within a period violates accounting standards and produces unreliable figures. Once a method is chosen, apply it consistently across all inventory.

The calculator guides users through proper input categories, reducing the risk of these common errors.

COGS for Service Businesses

Pure service businesses may not have traditional COGS, but many hybrid businesses do. A consulting firm selling only advice has no cost of goods sold. But a consulting firm that also sells software licenses has COGS on those licenses. A professional services firm that provides materials as part of projects should include those materials in COGS.

Service businesses often track Cost of Services instead, capturing direct labor and other costs of service delivery. While not technically COGS, similar principles apply for analyzing direct versus indirect costs and maintaining healthy margins.

The calculator focuses on product-based COGS but the concepts extend to any business tracking direct costs of revenue.

Using the Calculator Effectively

Enter beginning inventory representing the cost value of inventory at the start of your accounting period. This should match ending inventory from the previous period. Add all purchases of raw materials and goods for resale during the period. For manufacturers, include direct labor costs for production workers and manufacturing overhead directly tied to production. Include freight-in costs for shipping inventory to your facilities.

Enter ending inventory representing the cost value of inventory remaining at period end. This figure typically comes from physical inventory counts valued using your chosen method (FIFO, LIFO, or weighted average).

Optionally enter total revenue to see gross profit and gross margin calculated automatically. This contextualizes your COGS within overall business performance.

Compare results to industry benchmarks. If your COGS percentage significantly exceeds industry norms, investigate whether costs are genuinely higher or if expenses are being misclassified into COGS.


Cost of Goods Sold forms the foundation of product business profitability. Accurate COGS calculation ensures pricing covers costs, reveals true margins, and enables informed decisions about inventory, suppliers, and production. The calculator guides you through each component of direct costs, producing reliable figures that support sound business analysis.