How to calculate gross profit and gross margin (with COGS explained)
Gross profit = revenue − cost of goods sold. Here's the formula, what belongs in COGS for an online seller, gross margin, and how it differs from net profit.
By Sharjil Hameed · Published November 19, 2026 · Last reviewed November 24, 2026 · 2 min read · How we fact-check

Short answer: gross profit = revenue − cost of goods sold (COGS), and gross margin = gross profit ÷ revenue. With $120,000 in sales and $70,000 in COGS, gross profit is $50,000 and gross margin is 41.7%. Try it in the gross profit calculator.

What the gross profit calculator does
The gross profit calculator subtracts the direct cost of the products you sold from your revenue and shows gross profit and gross margin. Gross margin tells you how much of each sales dollar is left to pay for everything else: fees, ads, software, rent and you.
How gross profit is calculated
- Gross profit = revenue − COGS
- Gross margin % = gross profit ÷ revenue × 100
What counts as cost of goods sold
For an online seller, COGS is the cost of the items that actually sold during the period:
- Product cost or materials
- Inbound shipping and import duties to get stock to you
- Packaging that ships with the product
- Direct labor to make the product, if you pay for it
Things that usually aren’t COGS: ads, software, marketplace subscriptions and rent. Those are operating expenses. Treatment of selling fees varies, so pick one approach and keep it.
Worked example
- Revenue: $120,000
- Cost of goods sold: $70,000
- Gross profit: $50,000
- Gross margin: $50,000 ÷ $120,000 = 41.7%
If you then spend $35,000 on operating costs, your operating profit is $15,000. That’s why a 41.7% gross margin can still feel tight.
Gross profit vs net profit
| Gross profit | Net profit | |
|---|---|---|
| Subtracts | Cost of goods sold | Every cost, including operating expenses, interest and taxes |
| Tells you | Whether your product pricing works | Whether the whole business makes money |
| Fix it by | Raising prices or lowering product cost | Cutting any cost, or growing sales |
Work through the full picture in the net profit guide.
Options in the calculator
- Revenue and cost of goods sold for the same period (a month, a quarter or a year).
Why use this calculator
- Fast and clear: two numbers in, gross profit and margin out.
- Free and private, with a printable one-page report.
- One click to the next step: carry your gross profit into the net profit calculator or check per-item margin in the profit margin calculator.
Conclusion
Gross margin is the health check for your pricing. If it’s falling, look at product cost and price first. If it’s healthy but net profit isn’t, the problem is below the gross line: fees, ads or overhead.
Frequently asked questions
What is the gross profit formula? Gross profit = revenue − cost of goods sold.
How do I calculate gross margin percentage? Divide gross profit by revenue and multiply by 100.
Is gross profit the same as gross margin? No. Gross profit is a dollar amount; gross margin is that amount as a percentage of revenue.
Do shipping costs count in COGS? Inbound shipping to get stock to you usually does. Shipping labels to send orders to customers are often treated as a selling expense.
What is a good gross margin for ecommerce? It varies by category. Products you make yourself often run higher gross margins than resold goods. Compare your own margin over time rather than against a single benchmark.
Examples use round numbers. For how to report COGS for taxes, see the IRS small business pages or ask a tax professional.
Run the numbers yourself
Free calculators with every fee and formula shown.