Break-even is one division: fixed costs divided by contribution per unit. The interesting part is rounding. Get the direction wrong and the tool tells an owner they are safe when they are not.

def break_even(fixed_cents, price_cents, unit_cost_cents): contrib = price_cents - unit_cost_cents # per unit units = -(-fixed_cents // contrib) # ceil division # break-even sales = fixed * price / contrib, rounded up to the cent sales = -(-fixed_cents * price_cents // contrib) return units, sales def margin_of_safety_bp(current_cents, be_cents): # basis points, floor: never overstate the room you have return (current_cents - be_cents) * 10_000 // current_cents units, sales = break_even(2_250_000, 12_000, 6_600) print(units, sales / 100) print(margin_of_safety_bp(5_200_000, sales) / 100, '%') 

Output:

417 50000.0 3.84 % 

The example: $22,500 of fixed costs a month, price $120, unit cost $66. Each unit contributes $54 (45%). Break-even is $50,000 of sales or 416.67 units.

Rounding rules that keep the answer honest:

  • Units round up. You cannot sell two-thirds of a unit, and 416 units leaves you $36 short. -(-a // b) is integer ceiling division without floats.
  • Thresholds you must reach round up (break-even sales), room you think you have rounds down (margin of safety). At $52,000 of sales the exact margin of safety is 3.846%; flooring to 3.84% never overstates it.
  • Compute in cents, divide last. fixed * price // contrib keeps full precision until the final step.

The general rule: round every number in the direction that makes the result more conservative for the person relying on it.

Free browser version, same arithmetic: Break-Even Calculator (no sign-up).