Skip to content
FinToolSuite
Updated April 20, 2026 · Business & Startup · Educational use only ·

COGS Calculator

Cost of goods sold from inventory counts, plus gross margin and markup

Calculate cost of goods sold from inventory movements, plus gross profit, gross margin, and markup percentage in one view.

What this tool does

Cost of goods sold equals opening inventory plus purchases during the period minus closing inventory — the standard COGS formula. This calculator takes your opening inventory, purchases, and closing inventory figures and computes your COGS directly from those three values. If you also enter revenue, the tool calculates gross profit by subtracting COGS from that figure, then derives gross margin percentage and markup percentage. The results show what portion of your revenue remains after accounting for the direct costs of inventory, and how much profit is generated relative to those costs. This is useful for tracking production or retail operations across accounting periods, comparing profitability metrics over time, or understanding cost structure. The calculation assumes standard inventory accounting methods and doesn't account for write-offs, shrinkage adjustments, or non-inventory operating expenses. Results are for illustrative purposes based on the figures you provide.


Enter Values

People also use

Formula Used
Cost of goods sold
Opening inventory
Purchases
Closing inventory

Spotted something off?

Calculations or display — let us know.

Disclaimer

Results are estimates for educational purposes only. They do not constitute financial advice. Consult a qualified professional before making financial decisions.

The COGS Formula That Accounting Courses Teach

Cost of Goods Sold equals opening inventory plus purchases during the period minus closing inventory. This is the fundamental inventory-based COGS formula used in financial statements worldwide. If a bookshop starts the year with 50,000 of inventory, buys 200,000 more during the year, and ends with 60,000 of inventory, then 190,000 of inventory was sold — that is COGS. The formula works at monthly, quarterly, or annual granularity as long as the inventory counts are accurate at period boundaries.

Why COGS Matters More Than Revenue

Revenue is vanity. Gross profit (revenue minus COGS) is the first real indicator of whether a product line is viable. A clothing store doing 1M revenue at 800k COGS has 200k gross profit — 20% gross margin. Strip out operating expenses (rent, salaries, marketing) and what is left covers tax and profit. Compare to a clothing store doing 1M revenue at 400k COGS — 600k gross profit, 60% gross margin. Same top-line, completely different underlying business. COGS is the single biggest driver of how much room you typically need to run the rest of the business.

Gross Margin Versus Markup

Gross margin is gross profit divided by revenue — the seller's perspective. A product costing 40 sold for 100 has 60% gross margin. Markup is gross profit divided by COGS — the buyer's perspective. Same product has 150% markup (60 profit on 40 cost). Retailers quote markup (2x, 3x, 4x markup on cost). Finance quotes gross margin (60% margin). The two say the same thing from different angles. The calculator returns both so you can talk to whichever audience needs which number.

Periodic Versus Perpetual Inventory

Periodic inventory uses physical counts at period boundaries — slower, less accurate, cheaper. Perpetual inventory updates COGS every transaction via point-of-sale integration — faster, more accurate, more expensive. Both produce the same COGS formula. Small businesses often use periodic with annual counts. Larger retailers use perpetual with continuous tracking. The calculator is format-agnostic — whichever method you use, the formula applies.

What Actually Counts as COGS

Direct materials — the physical product you sell. Direct labor for making or preparing it. Freight-in (shipping from supplier to your warehouse). Import duties and customs. Packaging materials directly tied to the product. What is NOT COGS: marketing and advertising, administrative salaries, rent on non-warehouse space, software, insurance, professional services. These are operating expenses, below the gross profit line. The distinction matters for accurate gross margin calculations and for tax deductibility in some jurisdictions.

Worked Example

Online coffee roaster. Opening inventory: 25,000 in green coffee beans, packaging, and roasted stock. Purchases during the quarter: 85,000 (green beans, packaging, freight-in). Closing inventory: 22,000. Revenue for the quarter: 180,000. COGS: 25,000 + 85,000 - 22,000 = 88,000. Gross profit: 180,000 - 88,000 = 92,000. Gross margin: 51.1%. Markup on cost: 104.5%. Read: the roaster doubles its cost when selling, netting 51% gross margin before operating expenses eat into it. If operating costs (rent, salaries, marketing, software) run 70,000 for the quarter, net profit is 22,000 — which is why watching COGS as a ratio against revenue matters more than the absolute dollar amount.

Example Scenario

Opening $25,000 + purchases $85,000 - closing $22,000 gives COGS of 88,000.00.

Inputs

Opening Inventory:$25,000
Purchases During Period:$85,000
Closing Inventory:$22,000
Revenue (optional, for margin):$180,000
Expected Result88,000.00

This example uses typical values for illustration. Adjust the inputs above to match a specific situation and see how the result changes.

Sources & Methodology

Methodology

The calculator applies the standard inventory accounting formula to compute cost of goods sold by adding opening inventory and purchases during the period, then subtracting closing inventory. Gross profit is derived by deducting COGS from revenue. When revenue is provided, the calculator computes gross margin as the ratio of gross profit to revenue, expressed as a percentage, and markup as the ratio of gross profit to COGS, also as a percentage. The model assumes inventory values are accurate and that all purchases represent goods available for sale during the period. It does not account for inventory write-downs, shrinkage, obsolescence, or valuation adjustments such as lower-of-cost-or-market rules. Results are illustrative estimates based on the inputs supplied.

Frequently Asked Questions

How often should I calculate COGS?
Monthly if you have reliable inventory counts. Quarterly minimum for financial visibility. Annually at year-end for tax purposes. More frequent is better because unexpected COGS drift (theft, damage, supplier price changes) is harder to spot with less-frequent measurements.
What if I do not have inventory (services, digital products)?
COGS still applies but comes from different sources. For services: billable labor cost plus direct project materials. For digital products: hosting costs, platform fees, payment processing on sold units. The formula is less useful for service-based businesses — use a direct cost per unit calculation instead.
Include shipping I pay from supplier to warehouse?
Yes — freight-in is part of COGS. Include it in purchases. Shipping from warehouse to customer (freight-out) is not COGS — it is a separate operating expense.
What about write-offs for damaged or expired inventory?
Damaged inventory reduces closing inventory, which increases COGS (inventory disappeared without generating revenue). Some accountants prefer to track write-offs as a separate line for clarity. Either approach yields the same tax and profit outcome.

Related Calculators

More Business & Startup Calculators

Explore Other Financial Tools