Methodology
Every formula this calculator uses, how it rounds, and what it does when a calculation is impossible.
The formulas
All six calculation modes resolve to a cost and a selling price, and every other figure is derived from that pair. There is one code path, not six.
Working backwards from a target:
Converting between the two percentages:
Contribution margin
The advanced panel subtracts the variable cost of making a sale from gross profit:
Percentage fees are applied to net revenue, not to the tax-inclusive price. Where a price is entered inclusive of tax, tax is removed first: net revenue = price ÷ (1 + rate). Discounts are applied to the price before tax is extracted, because that is the order in which they happen at the till.
This calculator does not produce operating or net margin. Both require overheads it does not ask for, and a figure built on an assumed overhead would be worse than no figure.
Rounding
All arithmetic runs in double-precision floating point. Rounding happens only when a figure is displayed — never mid-calculation, and never fed back into a later step. Currency is shown to the conventions of the selected region; percentages to two decimal places. A displayed result re-entered as an input reproduces the original figures to two decimal places.
Impossible and edge cases
| Situation | What the calculator does |
|---|---|
| Selling price is zero | Margin is undefined rather than infinite. Profit is still shown. |
| Cost is zero | Margin is 100%. Markup is reported as not applicable, not as infinity. |
| Target margin of 100% or more | Refused, with an explanation. The formula would divide by zero. |
| Negative target margin | Allowed. Deliberate loss-leader pricing is a real decision. |
| Selling below cost | Negative profit and margin are shown and labelled as a loss. |
| Negative cost or price entered | Rejected at the field. |
| A field is empty | Treated as not yet answered, not as an error. |
No calculation returns NaN, infinity, or a blank where a number should be. The engine is covered by an automated test suite that asserts this for every case above.
Tax figures
The tax rate shown for each region is a starting value, not advice, and is editable. Rates change and vary by product and by business. Confirm the rate that applies to you with the relevant tax authority or your accountant before relying on any figure here.
Who maintains this
The calculator is built and maintained by Tech Media Daily. Formulas and worked examples were last reviewed on 27 August 2026. If you find an error, tell us — corrections are made and the review date updated.
This calculator provides estimates for informational purposes and is not financial, tax, accounting, legal or investment advice.