Margin Calculator

Calculate gross margin, markup, profit per unit, and total profit—or work backward from cost and a target margin to find the required selling price.

Direct cost or cost of goods sold per unit. Enter a cost of zero or more
Enter a selling price greater than zero
Used for total revenue, cost, and gross profit. Enter a whole number of at least 1

Calculation Results

Gross margin
%
Margin is profit divided by selling price; markup is profit divided by cost.

How to use the margin calculator

1
Choose actual or target mode
Actual mode measures an existing price. Target mode calculates the price required to achieve a chosen gross margin.
2
Use consistent cost inputs
For product gross margin, use direct cost of goods sold. If you include fees, shipping, or labor in cost, do so consistently across comparisons.
3
Enter quantity if needed
The percentage does not change with quantity, but total revenue, total cost, and total gross profit do.
4
Do not confuse margin with markup
Both use the same profit amount, but their denominators differ. Margin divides by revenue; markup divides by cost.

Margin and markup formulas

This calculator measures gross profit before operating expenses, interest, and taxes unless those amounts are included in the cost input. It does not automatically deduct payment processing fees, discounts, returns, or tax.

Gross profit = Selling price − Cost

Gross margin % = Gross profit ÷ Selling price × 100

Markup % = Gross profit ÷ Cost × 100

Required selling price = Cost ÷ (1 − Target margin as a decimal)

A target margin of 100% is mathematically impossible when cost is above zero because the required price would have no finite value.


Margin and markup examples

CostSelling priceProfitMarginMarkup
$60$100$4040%66.67%
$75$100$2525%33.33%
$80$100$2020%25%
$80$160$8050%100%

Methodology, assumptions and sources

The calculator uses the unrounded input values throughout and rounds only displayed money and percentages. “Cost” is treated as the direct cost assigned by the user, so the result is a gross margin unless the user deliberately enters fully loaded cost.

Sources:

Last reviewed: August 2026. Results are arithmetic estimates, not accounting, tax, or pricing advice.


Frequently asked questions

What is the difference between margin and markup?

Margin divides profit by selling price, while markup divides the same profit by cost. For a $60 cost and $100 price, margin is 40% but markup is about 66.67%.

How do I calculate a selling price from a target margin?

Convert the target margin to a decimal and divide cost by one minus that decimal. At a $60 cost and 40% target margin, the required price is $60 ÷ 0.60 = $100.

Can gross margin be negative?

Yes. Gross margin is negative when selling price is below the entered cost. That means the sale produces a gross loss before any additional operating expenses.

Should transaction fees and shipping be included in cost?

Include them if you want a contribution-style margin that reflects those variable costs. The key is to use the same cost definition whenever you compare products or periods.