Code tool

Weighted Margin Calculator

Use the same currency, period and cost basis for both lines. Margin uses revenue as denominator; it is not markup. No shared overhead is allocated, and no tax or currency conversion is modeled. Negative profit is allowed.

In-browser processingNo account requiredPrivacy details ↗

Weighted Margin Calculator

Line 1
Line 2

Use the same currency, period and cost basis for both lines. Margin uses revenue as denominator; it is not markup. No shared overhead is allocated, and no tax or currency conversion is modeled. Negative profit is allowed.

Inputs accept decimal notation, including a decimal exponent, up to 256 characters and 1,000 decimal places of scaling. The display uses rounded numbers; the report preserves raw and parsed inputs, exact fractions and unrounded numeric results. Extreme arithmetic that loses magnitude or makes cancellation uncertain is rejected.

Calculations stay in this browser; inputs are not uploaded or saved.

A QUICK WALKTHROUGH

How to use this tool

  1. Choose the mode matching your two lines of data.
  2. Enter revenue, margin or cost, and your amount unit. All fields start blank.
  3. Calculate, inspect both rows and totals, then copy or download the frozen report.

Revenue and stated margin

pᵢ = Rᵢ × mᵢ / 100; R = R₁ + R₂; p = p₁ + p₂; weighted margin = 100p/R; shareᵢ = 100Rᵢ/R. A zero-revenue line retains its stated margin; it is not an observed rate.

Revenue and raw cost

pᵢ = Rᵢ − Cᵢ; R = R₁ + R₂; C = C₁ + C₂; p = R − C; blended margin = 100p/R; line margin = 100pᵢ/Rᵢ. Any zero denominator gives an undefined rate.

Model

Use the same currency, period and cost basis for both lines. Margin uses revenue as denominator; it is not markup. No shared overhead is allocated, and no tax or currency conversion is modeled. Negative profit is allowed.

Calculation report

Inputs accept decimal notation, including a decimal exponent, up to 256 characters and 1,000 decimal places of scaling. The display uses rounded numbers; the report preserves raw and parsed inputs, exact fractions and unrounded numeric results. Extreme arithmetic that loses magnitude or makes cancellation uncertain is rejected.

Calculations stay in this browser; inputs are not uploaded or saved.

Calculations stay in this browser; inputs are not uploaded or saved.

GOOD TO KNOW

Common questions

Why can a simple average of margins differ?

Revenue shares determine the weight. Equal weighting only agrees when revenues are equal, or the two margins are equal. A total with zero revenue has no defined margin.

Revenue and raw cost

pᵢ = Rᵢ − Cᵢ; R = R₁ + R₂; C = C₁ + C₂; p = R − C; blended margin = 100p/R; line margin = 100pᵢ/Rᵢ. Any zero denominator gives an undefined rate.

Stated margin, not an observed margin at zero revenue

pᵢ = Rᵢ × mᵢ / 100; R = R₁ + R₂; p = p₁ + p₂; weighted margin = 100p/R; shareᵢ = 100Rᵢ/R. A zero-revenue line retains its stated margin; it is not an observed rate.