Margin Calculator

Calculate profit margin and markup from cost and selling price, or find a selling price for your target margin.

USD
Include the costs you want to account for. Use the same tax basis as the selling price.
USD
Display only; no currency conversion.
Whole items. Unit percentages stay the same.

Use decimal points, such as 60.50. Margin and markup use different denominators. Taxes, fees and overhead are not added automatically.

How to calculate profit margin

Subtract cost from selling price to get profit. Divide profit by selling price, then multiply by 100.

Margin (%) = (selling price − cost) ÷ selling price × 100.

For an item that costs USD 60 and sells for USD 100, profit is USD 40 and the margin is 40%. The quantity affects total revenue and profit, but not the unit percentages.

Margin versus markup

Margin uses selling price as its denominator. Markup uses cost. In the same example, USD 40 profit divided by USD 60 cost gives a markup of approximately 66.67%.

A 40% markup on USD 60 gives a price of USD 84, not USD 100. Profit is USD 24 and the margin is approximately 28.57%. The percentages measure different things.

Find a selling price for a target margin

Selling price = cost ÷ (1 − target margin ÷ 100). For a USD 60 cost and 40% target margin, divide 60 by 0.60 to get USD 100. A target of 100% is not possible with a positive cost and a finite selling price.

The calculation uses full precision. If the result includes a fraction of a cent, the displayed price rounds to the nearest cent. Round up when a minimum target must be met.

What to include in cost

Enter the cost basis you want to evaluate. For a product-level gross margin, that commonly means cost of goods sold. If you include extra expenses, the result instead reflects profit after those entered expenses. Do not assume it represents your whole business’s net margin.

Use cost and price on a consistent tax basis. Taxes, marketplace fees, payment fees, shipping and overhead are not automatically added. Percentage fees based on the selling price require separate treatment; this calculator does not infer them.

Losses and zero cost

A selling price below cost produces negative profit and margin. The tool flags that loss. A positive selling price with zero cost has a 100% margin, while markup is undefined because it would divide by zero. Price-building modes require positive cost.

Formula reference and privacy

Shopify’s profit-margin reference uses selling price as the margin denominator and distinguishes it from markup on cost. This tool uses those basic arithmetic definitions and does not depend on a paid service or current tax tables.

Calculations run in your browser. The calculator does not submit the cost and price values you enter to our server. Currency selection only changes the display label.

Frequently asked questions

What is the formula for profit margin?

−

Subtract cost from selling price, divide the profit by selling price, and multiply by 100. An item costing USD 60 and selling for USD 100 has a USD 40 profit and a 40% margin.