Cost of Goods Sold Calculator
COGS, gross profit, and gross margin from beginning inventory, purchases, and ending inventory.
Calculate cost of goods sold from beginning inventory, purchases, and ending inventory. Returns COGS, gross profit, and gross margin when revenue is entered.
What this tool does
This calculator computes cost of goods sold using the standard inventory-flow formula: beginning inventory plus purchases minus ending inventory. The result represents the total cost attributed to goods that left your inventory during the period. When you enter revenue, the tool also calculates gross profit (revenue minus COGS) and gross margin (gross profit divided by revenue), expressed as a percentage. The accuracy of your COGS output depends most on the reliability of your beginning inventory, purchases, and ending inventory figures. This tool is useful for closing accounting periods on a product business, reconciling inventory records, or checking COGS calculations derived from other sources. Note that this calculator models the accounting treatment of inventory flows and does not account for write-downs, returns adjustments, or non-inventory costs like labour or overhead.
Enter Values
People also use
Income
Side Hustle Calculator
Calculate true side hustle profitability after direct costs and opportunity cost of time. Enter revenue to see monthly true profit and gross profit.
Digital Nomad & Freelance
Freelance Rate Calculator
Calculate minimum freelance hourly rate from target income, billable hours, overhead, and the tax reserve required to net the target.
Money Insights
Burn Rate Calculator
Calculate your burn rate and savings rate. See what percentage of income is consumed and how much remains for wealth building.
Formula Used
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.
What this calculator does
Cost of goods sold is the direct cost of inventory that left the business during a reporting period — what was sold, valued at what it cost to produce or acquire. It sits above gross profit on an income statement and is the largest single expense line in most product businesses. The figure is computed from inventory flow rather than direct measurement: whatever opening inventory plus purchases produced, minus whatever's still on the shelf at period end, is the cost of what was sold. The calculator returns COGS as the headline figure and adds gross profit and gross margin when revenue is supplied so the figure sits in context.
How the math works
The formula is the inventory identity: COGS = BI + P − EI, where BI is beginning inventory, P is purchases during the period, and EI is ending inventory. Gross profit is revenue minus COGS; gross margin is gross profit divided by revenue. The identity assumes inventory counts at period start and period end are accurate — a miscount in either direction flows directly into COGS and from there into every downstream margin figure. Accurate counts at both endpoints are essential for the figure to mean what it claims to mean. For service businesses without physical inventory, an equivalent cost-of-revenue line is computed differently — typically from direct delivery costs incurred in the period — but the role of the figure in the income statement is the same.
Worked example
A product business with 50,000 in beginning inventory, 120,000 in purchases during the period, and 40,000 in ending inventory. COGS: 50,000 + 120,000 − 40,000 = 130,000. With 200,000 in revenue across the same period, gross profit is 200,000 − 130,000 = 70,000, and gross margin is 70,000 ÷ 200,000 = 35%. The 35% margin tells the operator that for every unit of revenue, 35 units are available to cover all the costs that sit below the gross profit line — operating expenses, taxes, financing, and what's left as net profit. A miscount at either inventory endpoint would distort all four figures simultaneously.
Why gross margin sits at the top of analysis
Gross margin is the upper bound on net margin: every other expense competes for what gross profit leaves behind. A business cannot produce a healthy net margin from a weak gross margin no matter how disciplined operating expenses are, because the gross figure caps the available room. Operators tracking margin trends month-on-month catch deteriorations earlier than those tracking net margin alone — gross margin moves first, and net margin follows once cost discipline can no longer absorb the change. The calculator's role is to surface the figure quickly enough to track it as a routine close-of-period check rather than as an annual review.
What counts as COGS and what does not
The boundary varies by business model, and the consequences for reported gross margin are real. Direct material costs, direct labour for production, and inbound freight to bring inventory to the warehouse are typically COGS. Packaging that ships with the product is typically COGS. Inbound storage during production flow is sometimes COGS, sometimes operating expense, depending on whether it sits within the inventory cycle or supports overhead more broadly. Marketing, sales commissions, customer support, software tools that are not used in production, and salaries of people not directly producing the product are typically operating expenses. The classification matters because it determines whether the cost compresses gross margin (COGS) or operating margin (OpEx) — the same total spend produces different headline figures depending on where it lands.
COGS in service businesses
Service businesses report a cost-of-revenue line that plays the same role as COGS without the inventory-flow identity. For a consultancy, that figure is typically the pass-through cost of contractors delivering client work plus client-specific tools and travel. For a SaaS business, it is hosting, third-party APIs, and the customer-success cost that scales with customer count. For a creative studio, it is freelancer fees and licensed assets used on client deliverables. The label and the inputs change but the position in the income statement and the role in margin analysis stay the same. Service businesses entering a cost-of-revenue figure in the calculator can use the BI and EI inputs at zero and enter the period's direct delivery cost in the purchases field.
Common errors to avoid
Three errors recur across small and growing operations. Inventory in transit at period end is sometimes double-counted — it appears on a purchase order but has not arrived, so it should not be in ending inventory but sometimes ends up there because it's expected. Inbound freight is sometimes expensed instead of capitalised into inventory; under either treatment the figure is real, but landed-cost treatment is the standard convention and produces a more accurate per-unit cost. Outbound fulfillment costs (picking, packing, shipping to the customer) sometimes get classified into COGS when they more naturally belong in operating expenses; the classification is allowed either way under most standards but typically applied consistently across periods so that gross margin is comparable period-on-period.
COGS of 130,000.00 = $50,000 beginning + $120,000 purchases − $40,000 ending inventory.
Inputs
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
COGS = beginning inventory + purchases − ending inventory. Gross profit = revenue − COGS (when revenue is entered). Gross margin = gross profit ÷ revenue. The inventory-flow identity is standard under both IFRS and US-GAAP product accounting; service businesses report an equivalent cost-of-revenue line computed from direct delivery costs in the period rather than from inventory movement. The calculator does not enforce a specific cost-flow assumption (FIFO, LIFO, weighted-average) — the figures entered should reflect whichever convention the operator's books are kept on, applied the same way at both inventory endpoints. Outbound fulfillment, marketing, and overhead are typically classified outside COGS in operating expenses, though landed-cost or absorption treatments place some of those costs in inventory; the calculator works at whichever classification is entered.
Frequently Asked Questions
What is the difference between COGS and operating expenses?
Should shipping costs be in COGS?
How is the figure computed for a business without physical inventory?
Can COGS be negative?
Why do figures sometimes differ from accounting-software COGS?
Related Calculators
More Digital Nomad & Freelance Calculators
Digital Nomad & Freelance
Agency Margin Calculator
Compute agency gross and net margin from revenue, contractor costs, and overhead. Returns net margin, gross profit, net profit, and gross margin in one view.
Digital Nomad & Freelance
Agency vs Freelance Income Calculator
Compare net income from running an agency versus working as a freelancer. Returns net income, effective hourly rate, and the gap between the two models.
Digital Nomad & Freelance
AI Implementation ROI Calculator
Calculate AI implementation ROI from cost, time savings, labour hourly rate, and the multi-year horizon over which it pays back.
Digital Nomad & Freelance
Annual Freelance Revenue Calculator
Project annual freelance revenue from monthly billable hours, hourly rate, and effective working months per year. Returns annual revenue and monthly revenue.
Digital Nomad & Freelance
Billable Hours Calculator
Project annual billable hours from weekly hours, utilisation percent, and weeks worked. Returns annual, monthly, weekly billable, non-billable, and revenue.
Digital Nomad & Freelance
Client Acquisition Cost Calculator
Compute customer acquisition cost (CAC) and the LTV-to-CAC ratio from marketing spend, sales spend, new clients, and average client value.
Explore Other Financial Tools
Budget
Daily Spending Limit Calculator
Calculate your daily discretionary spending limit from income, fixed costs, and savings goals. Simple budget math that works.
Savings
Lump Sum Investment Calculator
Calculate how a lump sum investment grows over years with compound returns. See final balance and interest earned from a one-time deposit.
Investing
100 Minus Age Asset Allocation Calculator
Calculate stock-vs-bond allocation using the 100-minus-age rule of thumb — see the suggested percentage split for any age you put in.