Cost of Goods Sold Calculator
Calculate your cost of goods sold (COGS) using the beginning inventory, purchases, and ending inventory method. See your gross profit, gross margin, and markup percentage to understand your product-level profitability.
Cost of Goods Sold (COGS) is the direct cost of producing the goods or services your business sells. It includes raw materials, direct labor, and manufacturing overhead directly tied to production — but excludes indirect expenses (rent, marketing, executive salaries, R&D). COGS is one of the most important numbers on any income statement because it directly determines gross profit and gross margin, which together reveal product-level profitability and pricing power.
The COGS calculation captures what items actually sold cost (not what's sitting in inventory). The formula: Beginning Inventory + Purchases + Direct Costs − Ending Inventory = COGS. This accounts for the fact that purchases made during the period that haven't been sold yet shouldn't count as cost of goods sold — they're still inventory. Different inventory accounting methods (FIFO, LIFO, weighted average) produce different COGS values; choice affects taxable income and balance sheet presentation but doesn't change underlying economics.
This calculator computes COGS from beginning/ending inventory and direct costs, then calculates gross profit, gross margin %, and markup %. Use it for: monthly/quarterly P&L preparation, product profitability analysis, pricing decisions (understanding minimum margin requirements), and inventory management. Important context: COGS dominates margin analysis for product-based businesses (manufacturers, retailers, restaurants). For service businesses, COGS is mostly labor; for SaaS, COGS is hosting/infrastructure plus customer support (typically 15-30% of revenue). Industry benchmarks vary enormously — restaurants target 30-35% food cost; retailers 50-70% product cost; SaaS 15-25% COGS. Track COGS as % of revenue over time — rising COGS % signals pricing or efficiency problems.
Inputs
Shipping, packaging, etc.
Results
Cost of Goods Sold
$300,000
Gross Profit
$200,000
Gross Margin
40.0%
Markup
66.7%
Revenue Breakdown
Cost Components
Formula
How to use this calculator
- Enter beginning inventory value (value of inventory at start of period).
- Enter purchases during period (cost of inventory acquired during period, including freight-in if applicable).
- Enter direct labor costs (wages of workers directly producing goods — assembly, manufacturing, restaurant cooks, etc.).
- Enter other direct costs (manufacturing overhead, shipping, packaging directly tied to production).
- Enter ending inventory value (value of inventory still on hand at period end).
- Enter total revenue for the period.
- Review COGS, gross profit, gross margin %, and markup %.
- Compare gross margin to industry benchmarks for your specific industry.
- For improvement: focus on either reducing COGS (negotiate supplier pricing, improve production efficiency, reduce waste) or increasing prices (test market acceptance).
- Track gross margin % over time monthly/quarterly. Trending downward signals issues requiring attention.
- Inventory accuracy matters enormously. Physical inventory counts vs. book inventory should match closely; large variances suggest theft, accounting errors, or process problems.
Worked examples
Restaurant COGS analysis
Restaurant: $30K beginning food inventory, $120K food purchases, $0 direct labor (separate), $5K other direct (containers, supplies), $35K ending inventory, $400K revenue. COGS = $30K + $120K + $5K − $35K = $120K Gross Profit = $400K − $120K = $280K Gross Margin = 70% Food cost percentage: $120K / $400K = 30% Healthy food cost — well-run restaurants target 28-32% food cost. Above 35% suggests menu pricing too low, waste issues, or supplier costs need negotiation. Adding direct labor for "prime cost" analysis: if labor $130K, prime cost = ($120K + $130K) / $400K = 62.5%. Restaurants typically target prime cost (food + labor) under 60-65%. Slightly high — opportunity to optimize labor scheduling or menu engineering.
Retail COGS comparison
Specialty retailer: $80K beginning inventory, $400K purchases, $20K freight/handling, $100K ending inventory, $750K revenue. COGS = $80K + $400K + $20K − $100K = $400K Gross Profit = $350K Gross Margin = 47% Within healthy range for specialty retail (typically 40-55%). Inventory turnover: COGS / Average Inventory = $400K / $90K = 4.4x annually — moderate (typical specialty retail 3-6x). Improvement opportunities: Increase prices on premium SKUs (test elasticity) Negotiate better supplier terms at higher volumes Optimize inventory mix toward higher-margin items Reduce dead stock through clearance pricing Tracking COGS % monthly reveals whether margins are improving or deteriorating.
SaaS COGS distinction
B2B SaaS: $0 inventory (no physical product), $30K hosting/infrastructure, $25K customer support team allocated to COGS, $0 other, $0 inventory, $250K revenue. COGS = $55K Gross Margin = ($250K − $55K) / $250K = 78% Within healthy SaaS range (typically 70-85%). High gross margin is the SaaS advantage — software replicates at near-zero marginal cost, so each additional customer adds revenue with minimal additional COGS. SaaS COGS components: Cloud hosting (AWS, GCP, Azure) Third-party services and integrations Customer support (allocated portion) Content delivery networks Payment processing fees Software licenses needed for delivery NOT included in SaaS COGS: Sales and marketing Engineering (product development) General administrative Office rent Higher COGS % for SaaS (above 30%) suggests infrastructure inefficiency or excessive support overhead.
When to use this calculator
Use this calculator for monthly/quarterly P&L preparation, product profitability analysis, pricing decisions, supplier negotiation, or inventory management.
Pair with profit-margin (overall profitability), contribution-margin (product-level margin including variable costs), and inventory-turnover (efficiency).
Important COGS considerations:
1. **Direct vs. indirect cost distinction.** COGS includes only direct production costs. Marketing, executive salaries, office rent, and R&D are operating expenses (below gross profit line), not COGS.
2. **Inventory accounting method affects COGS.** FIFO vs. LIFO vs. weighted average produce different numbers in inflationary environments. Choice affects taxable income; verify with accountant.
3. **Service business COGS often dominated by labor.** Consulting, agencies, professional services — direct billable hours of staff. Calculate fully-loaded labor cost (salary + benefits + overhead) for accuracy.
4. **SaaS COGS smaller than people expect.** Just hosting and direct support, typically 15-30% of revenue. Software development is operating expense, not COGS.
5. **Track COGS as % of revenue, not just dollars.** Absolute COGS grows with revenue; only % reveals efficiency. Rising COGS % is a red flag even if absolute COGS is normal.
6. **Industry context dominates.** A 50% COGS is great for electronics retail (typically 70-85%), problematic for software (typically 15-30%). Compare to industry peers.
7. **Inventory accuracy matters.** Physical counts vs. book inventory should match closely. Large variances suggest theft, accounting errors, or process problems requiring investigation.
8. **Dead inventory inflates current COGS.** Obsolete or slow-moving inventory write-downs increase COGS. Active inventory management prevents accumulating dead stock.
9. **Freight-in vs. freight-out.** Freight to receive inventory: typically capitalized into inventory cost. Freight to ship to customers: operating expense, not COGS.
10. **Manufacturing overhead allocation.** Indirect production costs (factory utilities, equipment depreciation, supervisor salaries) allocated to inventory based on production volume. Affects COGS via inventory valuation.
11. **Returns affect COGS.** Returned products typically come back into inventory at original cost; refunded revenue and returned COGS net out the original sale.
12. **Restaurants include labor in COGS.** Unique to industry — kitchen labor often included in COGS (because variable with production volume) while wait staff in operating expenses.
Common mistakes to avoid
- Including indirect costs in COGS. Rent, marketing, executive salaries belong in operating expenses, not COGS.
- Ignoring ending inventory adjustment. Purchases ≠ COGS. Only items actually sold count; unsold inventory stays on balance sheet.
- Tracking COGS dollars without % of revenue. Dollar COGS grows with sales; % reveals real efficiency trends.
- Mixing inventory accounting methods inconsistently. Pick one method and apply consistently (FIFO usually simplest).
- Not investigating inventory variance. Physical-vs-book differences signal theft, accounting errors, or process issues.
- Comparing COGS % across industries. Industry context dominates; benchmark against peers, not other industries.
Frequently Asked Questions
Sources & further reading
- Small Business Financial Resources — U.S. Small Business Administration
- Inventory Methods and COGS — U.S. Internal Revenue Service
- Industry Financial Benchmarks — U.S. Census Bureau Economic Census
Related Calculators
Profit Margin Calculator
Calculate gross, operating, and net profit margins from your revenue and costs.
Break-Even Calculator
Find how many units you need to sell to cover your costs.
Contribution Margin Calculator
Calculate your contribution margin to understand how much each sale contributes to profit.