How the Margin Calculator Works
The calculator offers four solve-for modes built on the cost–price–profit identity. From a cost and selling price it returns gross profit = price − cost, margin = profit ÷ price × 100 and markup = profit ÷ cost × 100. From a cost and a target margin it prices the item as price = cost ÷ (1 − margin ÷ 100). From a cost and a target markup it prices it as price = cost × (1 + markup ÷ 100). From a selling price and a target margin it backs out the cost as cost = price × (1 − margin ÷ 100). Every result is produced by a pure function in a small, unit-tested engine, with the worked formula and gross profit shown live as you type.
- Gross profit = selling price − cost
- Margin % = profit ÷ price × 100 (share of revenue)
- Markup % = profit ÷ cost × 100 (share of cost)
- Price from margin: price = cost ÷ (1 − margin ÷ 100)
- Price from markup: price = cost × (1 + markup ÷ 100)
