Start with one item and one consistent monetary unit. Use the price you actually receive after a discount, and a realistic cost for that item. For a period of sales, use net sales and cost of goods sold (COGS) for the same period.
01 / Understand
One amount, two percentages.
Gross profit is selling price minus the direct cost of that item. Across a reporting period, it is net sales minus COGS. Gross profit is before costs such as rent, general wages, marketing and other operating expenses. It is not take-home profit.
Gross profitSelling price − item cost
Gross marginGross profit ÷ selling price × 100%
MarkupGross profit ÷ item cost × 100%
Margin tells you what share of the sale remains after the item cost. Markup tells you how much was added relative to cost. They use different starting points, so a 40% markup does not produce a 40% margin.
02 / Work it through
A 50% markup is a 33.3% margin.
Suppose a shop buys an item for 100 and sells it for 150, in the same currency. Gross profit is 50.
Margin: 50 ÷ 150 × 100 = 33.3% (rounded).
Markup: 50 ÷ 100 × 100 = 50%.
The cash difference is the same 50. Only the denominator changes. If someone asks for a “40% profit,” clarify whether they mean margin on sales or markup on cost before setting the shelf price.
03 / Set a target
Work backward from a desired margin.
For a target gross margin below 100%, convert the percentage to a decimal and use:
Target selling price = item cost ÷ (1 − target margin)
At a cost of 100 and a target margin of 40%, the price is 100 ÷ (1 − 0.40) = 166.67 when rounded up to two decimal places. At 166.67, gross profit is 66.67 and margin is approximately 40%. Adding a 40% markup instead gives a price of 140 and a margin of about 28.6%.
This is a gross-margin calculation, not a full pricing decision. Check taxes, fees, discounts, local rules, overhead, demand and competitor prices separately. Keep your cost basis consistent when comparing products.
04 / Check the inputs
Losses and zero denominators.
- Price below cost: gross profit, margin and markup are negative when the denominators are positive. That is a gross loss on the item, even if selling it frees shelf space.
- Price of zero: gross margin is undefined because it would divide by zero. With a positive cost, gross profit is a loss equal to the cost and markup is −100%.
- Cost of zero: markup is undefined because it would divide by zero. At a positive price, the arithmetic margin is 100%, but check that the cost is truly zero rather than missing or misclassified.
- Target margin of 100% or more with positive cost: the target-price formula has no finite selling price. A negative cost or price is not a normal retail input.
From guide to tool
Test the numbers for your own item.
The Profit & Stock Calculator lets you enter cost and selling price to see gross profit, margin and markup together. Its Target Selling Price section works backward from a desired gross margin and rounds the suggested price upward to two decimal places. It does not decide whether customers will accept that price.
Use Profit & Stock CalculatorEvidence / Sources
What this guide is based on.
Last checked: . The worked examples are ShopsInto calculations using the formulas above. Sources support the accounting terms and formulas; they do not set a universal “good” margin for every shop.
- What Is Gross Margin? Formula and How To Calculate It — Shopify, 28 August 2026. Gross profit, gross margin, cost of goods sold, and the distinction from operating expenses.
- Markup vs. Margin: Key Differences + How To Calculate — Shopify, 16 September 2026. Markup and margin denominators, and pricing backward from a target gross margin.
See how ShopsInto researches guidance and our disclosure.