Pricing • 4 min read

How to calculate profit margin: check costs, discounts and zero sales

Calculate gross margin and a separate after-fee contribution, test a discounted sale and understand why zero revenue has no defined margin percentage.

Start by naming the profit you are measuring. Gross margin uses revenue less cost of sales; a calculation that also subtracts payment and fulfillment costs answers a different question. The examples below use invented amounts and fee assumptions, not industry benchmarks or guaranteed earnings.

Use revenue as the denominator

For a product sold for USD 100 with USD 55 cost of sales, gross profit is USD 45. Gross margin is 45 ÷ 100 × 100 = 45%. The markup on that cost is 45 ÷ 55 × 100 = approximately 81.82%; the two percentages describe the same difference using different denominators.

The SEC's introductory guide distinguishes gross profit from later operating expenses and net profit. Use consistent cost classifications before comparing results between products or periods. A calculator cannot determine those classifications from a single Cost input.

Margin calculation worksheet
Revenue after the sale discount: [R]
Cost of sales on the same basis: [C]
Gross profit = R − C
Gross margin % = (R − C) ÷ R × 100, provided R is greater than zero.
Record separately which costs have and have not been included.

Show the extra deductions explicitly

Assume the sale also incurs USD 10 of incremental packing and fulfillment costs not included in the USD 55, plus a fictional processing charge of 3.2% of the selling price and USD 0.30. For a USD 100 sale, the fee is USD 3.50. The amount remaining after these listed costs is USD 31.50.

That 31.50% contribution is not the same as the 45% gross margin above. It still excludes costs such as business-wide overhead and income tax; calling it net business profit would overstate what the exercise establishes.

Keep the cost layers visible
StepUSD remaining
Revenue100.00
Less cost of sales: 55.0045.00 gross profit
Less separate fulfillment: 10.0035.00
Less assumed processing fee: 3.5031.50 contribution after listed costs

Recalculate after a discount

A 10% discount lowers the price to USD 90. Cost of sales stays USD 55 in this example, so gross profit falls to USD 35 and gross margin to approximately 38.89%. Do not subtract ten percentage points from the previous 45% margin.

At the same fictional fee schedule, the fee becomes USD 3.18. After the separate USD 10 fulfillment cost, contribution is USD 21.82, approximately 24.24% of the discounted price. The fee basis and cost assumptions must be consistent across both calculations.

Treat zero and loss-making cases correctly

If revenue is USD 80 and cost is USD 100, profit is minus USD 20 and margin is minus 25%. A negative result is meaningful; it should not be replaced by zero.

If revenue is zero, the margin formula divides by zero and the percentage is undefined, even when costs are also zero. If revenue is USD 100 and entered cost is zero, margin is 100% on those entered costs, while markup on a zero cost is undefined. Neither example proves that the business has no other costs.

Boundary checks
RevenueEntered costProfitMargin
USD 100USD 55USD 4545%
USD 80USD 100−USD 20−25%
USD 0USD 100−USD 100Undefined
USD 100USD 0USD 100100% on the entered cost basis

Check the inputs before using the result

Enter revenue and costs for the same unit or period in the profit-margin calculator. For the gross example, use Cost 55 and Selling price / revenue 100. For the after-fee exercise, total only the costs you intend to include and label your result accordingly.

Use one currency and consistent treatment of discounts and taxes. The calculator does not determine tax liability, look up payment-provider fees or fetch your accounting records.

Free Docuivo tool

Put this guide into practice.

Calculate profit margin →

This guide provides general educational information and is not legal, accounting, tax or financial advice. Requirements vary by country, industry and transaction. See how Docuivo tests its tools and calculations.