Calculate GP: Gross Profit Formula, Margin, and Markup
Calculate GP from net sales and cost of goods sold with checked examples for returns, discounts, inventory, gross margin, and cost-based markup.

Information checked November 8, 2026. All examples are hypothetical and use US dollars. IRS references concern US federal tax reporting, not a universal financial-statement presentation.
To calculate GP, subtract cost of goods sold from net sales for the same period. GP here means gross profit, a currency amount. It is the subtotal before the remaining operating expenses and later items, not the percentage of sales retained or the final profit available to owners.
Gross profit = net sales − cost of goods sold.
The SEC’s financial-statement guide moves from gross sales through returns and allowances to net revenue, then deducts cost of sales. Starting from the right revenue figure is as important as doing the subtraction correctly.
First identify net sales, not cash deposits
Gross sales can include amounts later reduced by customer returns, allowances, or discounts. Use the revenue after the applicable reductions. If a statement already reports net revenue, do not subtract the same reductions again.
Customer payments are not automatically the sales figure for a period. Some sales might remain uncollected, while cash received might settle earlier sales. The SEC distinguishes income and cash-flow statements, which answer different questions.
For US federal Schedule C, IRS Publication 334 says returns and allowances include customer refunds, rebates, and other reductions from the actual sales price. It also distinguishes buyer-imposed sales taxes collected for a government from taxes imposed on the seller. Our example excludes buyer-imposed sales tax collected for remittance rather than treating it as revenue.
A complete example with returns and discounts
Assume a retailer reports the following for one month. Returns and discounts are separate reductions and do not overlap. The stated cost of goods sold already reflects all relevant inventory adjustments, including merchandise returned to stock. There are no other revenue reductions or sales costs omitted from the illustration.
| Step | Amount |
|---|---|
| Gross sales | $100,000 |
| Customer returns and allowances | −$5,000 |
| Sales discounts | −$2,000 |
| Net sales | $93,000 |
| Cost of goods sold | −$57,000 |
| Gross profit | $36,000 |
Net sales are $100,000 − $5,000 − $2,000 = $93,000. Gross profit is $93,000 − $57,000 = $36,000.
Using $100,000 as revenue would overstate the subtotal by $7,000. Deducting the returns and discounts again from $93,000 would understate it by the same amount.
This is a reliable way to calculate GP: reconcile the revenue inputs first, then use costs that correspond to the goods actually sold. Keep the reporting period and currency units consistent. A quarterly revenue total and an annual cost total cannot produce a meaningful quarterly result.
Gross margin and markup use different denominators
Gross profit is $36,000 in the example. To express it relative to sales, calculate:
Gross margin = gross profit ÷ net sales × 100.
Here, $36,000 ÷ $93,000 × 100 = 38.71%, rounded. About 38.7 cents of each net sales dollar remains before costs below the gross-profit subtotal. Publication 334 similarly tests gross profit as a percentage of net receipts.
For cost-based markup, use cost in the denominator instead:
Markup = gross profit ÷ cost of goods sold × 100.
The same example gives $36,000 ÷ $57,000 × 100 = 63.16%. The dollar profit has not changed. Only the comparison base has changed.
A separate single-item check makes the difference clear. A product costing $100 and selling for $140 has $40 gross profit. Its markup is 40%, but its margin is $40 ÷ $140 = 28.57%. Label the denominator rather than relying on the word “percentage.”
If net sales are zero, the margin calculation is undefined. A dollar gross loss can still be calculated. Likewise, cost-based markup cannot be calculated by dividing by zero cost.
Match inventory costs to sales
Buying inventory does not mean every purchase belongs in the current period’s cost of goods sold. In a simplified retailer reconciliation:
COGS = beginning inventory + net inventory purchases and applicable acquisition costs − ending inventory.
For a separate example, assume $12,000 beginning inventory, $50,000 net purchases, $2,000 applicable freight-in, and $7,000 ending inventory. Assume no manufacturing costs, personal withdrawals, losses, or other adjustments.
COGS is $12,000 + $50,000 + $2,000 − $7,000 = $57,000. Available inventory cost is $64,000, reconciled to $57,000 sold plus $7,000 remaining. Publication 334, chapter 6, explains this inventory bridge and freight-in treatment for its US tax context.
Returned goods require attention on both sides. A sales refund reduces revenue, while saleable merchandise returned to stock can affect inventory and the related cost expense. Do not keep an unadjusted original cost figure merely because the sales reduction is easier to find.
Cost classification changes what the subtotal means
COGS is not necessarily just materials or variable spending. IRS guidance includes relevant manufacturing overhead such as rent and depreciation. The cost-accounting guide explains why fixed/variable and direct/indirect classifications answer different questions.
Contribution margin instead subtracts variable costs for analysis. The Open University’s costing explanation separates variable product costs from fixed period costs in marginal costing. Do not substitute that approach for a reported gross-profit subtotal.
Inventory methods matter too. Our FIFO and LIFO comparison shows different reported gross profit from the same sales and purchases under changing costs. Compare policies before treating a higher margin as better operations.
Service companies can report cost of services or cost of revenue. Do not assume every business presents an identical subtotal. Publication 334 separately allows many service businesses without merchandise to figure gross profit directly from net receipts for Schedule C. That tax convention does not establish every service company’s financial-reporting format.
Conclusion
To calculate GP use net sales minus matching cost of goods sold, then reconcile returns, discounts, and inventory. Label margin and markup separately. The result measures one level of profitability, not cash generation or the bottom line. Our operating-income guide follows the next step after gross profit.
Frequently Asked Questions
Can gross profit be negative?
Yes. If cost of goods sold exceeds net sales, the subtraction produces a gross loss. Other expenses can make the final loss larger.
What if net sales are zero?
You can still subtract cost of goods sold to determine gross profit or loss. A gross-margin percentage using net sales as its denominator is undefined when net sales are zero.
Is a 40% markup a 40% gross margin?
No. If cost is $100 and price is $140, gross profit is $40. Cost-based markup is 40%, but gross margin is $40 divided by $140, or about 28.57%.
Should I subtract customer returns twice?
No. If the reported revenue figure is already net of the relevant returns and discounts, do not deduct them again. Also check whether returned merchandise appropriately changes inventory and cost of goods sold.
Does cost of goods sold mean only variable costs?
No. Qualifying manufacturing overhead can include items such as factory rent and depreciation. Gross profit is not automatically the same as contribution margin, which separates variable costs for analysis.
Does every service business report the same gross-profit subtotal?
No. Financial statements can show cost of services or cost of revenue, with classifications that require explanation. US Schedule C guidance has a separate convention for services without merchandise. Read the actual basis before comparing percentages.
Disclaimer: This article is for educational purposes only and is not financial advice. Consider your own situation and speak with a qualified professional before making financial decisions. How we write and review content.


