Margin and Markup Calculator

Turn a cost and a selling price into margin and markup, or build a selling price from a cost plus one of those percents. The two percents use different denominators.

Last updated: October 6, 2026

Tool

This tool will load here.

What this calculator does

A margin and markup calculator keeps two percents that people mix up because both start from the same gain. The gain is selling price minus cost. Margin divides that gain by the selling price. Markup divides that gain by the cost. A 20 percent margin is not a 20 percent markup. On a cost of 80 and a price of 100, the gain is 20, the margin is 20 percent, and the markup is 25 percent.

The page has three modes. From cost and selling price, it reports both percents. From cost and margin, it builds a selling price and then the markup of that price. From cost and markup, it builds a selling price and then the margin of that price. When a mode builds a price, the percents you see afterward are calculated from the rounded price, so the three lines describe one another.

A price below cost is allowed in the first mode. Both percents come out negative. That is a signed result. It is not advice to raise or cut a price, and it is not a profit-and-loss statement. This page does not link the idea to a discount. A discount takes a percent off a listed price. Margin and markup answer a different question, and the denominator is the whole distinction.

How to use

  1. Choose a mode.
  2. Enter the cost, greater than 0, with at most two decimal places.
  3. Enter the selling price, the margin percent, or the markup percent, matching the mode.
  4. Calculate. Read the selling price, the margin, and the markup. Example uses cost 80 with price 100, margin 20, or markup 25, depending on the mode.

Enter in a field runs Calculate. Switching mode shows the field that mode needs and hides the others. Clear returns to cost and selling price.

Formula

Margin = (price − cost) ÷ price × 100. Markup = (price − cost) ÷ cost × 100. Price from margin = cost ÷ (1 − margin ÷ 100). Price from markup = cost × (1 + markup ÷ 100). The selling price is rounded half away from zero to cents. Each percent is rounded half away from zero to two decimal places, and trailing zeros are omitted on the percent lines, so 20.00 is shown as 20% and 20.10 as 20.1%.

A margin of 100 percent is rejected because the price would not be finite: the divisor becomes zero. A markup of −100 percent is rejected because the price would be zero. Margin may be as low as −1000 and must stay below 100. Markup must be greater than −100 and at most 10000. Those bounds stop a nonsense percent from pretending to be a price.

Example

Cost 80 and price 100: margin 20%, markup 25%. Cost 50 and price 50: both percents are 0. Cost 100 and price 80: margin −25%, markup −20%. Cost 80 and margin 20: price 100.00 and markup 25%. Cost 80 and markup 25: price 100.00 and margin 20%. Those reconstructions land on the same three numbers because 20 and 25 are exact for this pair.

Gain = 100 − 80 = 20
Margin = 20 ÷ 100 = 20%
Markup = 20 ÷ 80 = 25%

Limits

  • One cost and one selling price. No basket, no fees, no shipping, and no tax.
  • No target margin recommendation and no statement that a price is the right one to charge.
  • Money uses at most two decimal places, from 0 up to 999,999,999,999.99, and cost must be greater than 0.
  • Percent inputs use at most two decimal places. A third decimal is rejected.
  • A selling price that rounds to 0.00 is rejected.

Privacy

The calculation stays in the browser. Costs and prices are not sent to YallaSolve and are not stored as a catalog. Clear the fields when you are done. Do not paste a customer file into the form.

On this page

Related Articles

Related guides

Related solutions

Related Tools

Need another tool ?

Open the free tools — no signup.

FAQs

newsletter signup

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Innovative Solutions For Modern Needs
Copyright © 2026 Yallasolve. all rights reserved.