ROI Calculator Formula

Understand the math behind the roi calculator. Each variable explained with a worked example.

Formulas Used

Net Gain/Loss

gain = final_value - initial_investment

ROI

roi = initial_investment > 0 ? (final_value - initial_investment) / initial_investment * 100 : 0

Variables

VariableDescriptionDefault
initial_investmentAmount Invested(USD)10000
final_valueFinal Value(USD)14000

How It Works

ROI Formula

ROI = (Final Value - Initial Investment) / Initial Investment × 100%

A positive ROI means you gained money; negative means you lost money.

Worked Example

You invested $10,000 and it is now worth $14,000.

initial_investment = 10000final_value = 14000
  1. 01Net gain = $14,000 - $10,000 = $4,000
  2. 02ROI = $4,000 / $10,000 × 100% = 40%

Ready to run the numbers?

Open ROI Calculator