Bookmarks    
nPr and nCr    
Random Number    
SD Calculator    
Sample Size    
Percent Error    
Density    
Molarity    
Molar Mass    
Ohm's Law    
Watts to Amps    
Voltage Drop    
Long Division    
Mixed Numbers    
Rounding    
Nth Root    
Exponents    
Half-Life    
Polar Form    
De Moivre    
3D Distance    
Point to Line    
Cross Product    
Determinant    
Sin Cos Tan    
Triangle Area    
Scale Factor    
Sector Area    
Ellipse Area    
Cube Volume    
Box Volume    
Sphere Volume    
Cone Volume    
Pipe Volume    
Time Duration    
Time Card    
Present Value    
Future Value    
Churn Rate    
A/B Test Calc    
SEO Traffic    
Ideal Weight    
Fat Intake    
Child Height    
Golf Handicap    
Heat Index    
Wind Chill    
Dew Point    
Download Time    
kWh to Cost    
AC Size (BTU)    
Heating Costs    
LED Savings    
Trip Gas Cost    
Tire Size    
Solar Output    
Solar Payback    
Battery Size    
Wall Area    
Gravel Needed    
Mortar Mix    
Slope Grade    
Curtain Size    
Soil Needed    
Sod Needed    
Ramp Length    
Blind Size    
Drain Slope    
Board Feet    
Heat Loss    
Furniture Fit    
Moving Boxes    
Plywood Cuts    
Shelf Sag    
   Add
Probability and random number calculators
Independent Events
Independent Events
Two Events Solver
Two Events Solver
Repeated Trials
Repeated Trials
Bayes' Theorem
Bayes' Theorem
Expected Value
Expected Value
Binomial Distribution
Binomial Distribution
nPr and nCr
nPr and nCr
Circular Permutation
Circular Permutation
With Repetition
With Repetition
Random Number
Random Number
Averages and statistics calculators
Average Calculator
Average Calculator
Mean Median Mode
Mean Median Mode
SD Calculator
SD Calculator
Quartiles & IQR
Quartiles & IQR
Frequency Table
Frequency Table
Correlation (r)
Correlation (r)
Normal Probability
Normal Probability
Z-Score Calculator
Z-Score Calculator
Confidence Interval
Confidence Interval
Sample Size
Sample Size
Mark & Recapture
Mark & Recapture
P-Value Calculator
P-Value Calculator
Percentage and ratio calculators
Percentage Calc
Percentage Calc
Percent Change
Percent Change
Percent Difference
Percent Difference
Percent Error
Percent Error
Ratio Calculator
Ratio Calculator
Discount Calculator
Discount Calculator
Sales Tax Calculator
Sales Tax Calculator
Margin Calculator
Margin Calculator
Speed calculators
Speed Calculator
Speed Calculator
Density and concentration calculators
Density
Density
Molarity
Molarity
Molar Mass
Molar Mass
Physics and electricity calculators
Ohm's Law
Ohm's Law
Watts to Amps
Watts to Amps
Resistor Colors
Resistor Colors
Voltage Drop
Voltage Drop
Unit conversion calculators
Weight Converter
Weight Converter
Shoe Size Converter
Shoe Size Converter
Integer and signed number calculators
Long Division
Long Division
LCM Calculator
LCM Calculator
GCF Calculator
GCF Calculator
Integer Calculator
Integer Calculator
Prime Factorization
Prime Factorization
Diophantine Solver
Diophantine Solver
Modulo Calculator
Modulo Calculator
Factor Calculator
Factor Calculator
Roman Numerals
Roman Numerals
Fraction, decimal and rounding calculators
Fraction Calculator
Fraction Calculator
Mixed Numbers
Mixed Numbers
Simplify Fractions
Simplify Fractions
Fraction to Decimal
Fraction to Decimal
Decimal to Fraction
Decimal to Fraction
Rounding
Rounding
Equation and inequality calculators
Linear Equation
Linear Equation
Linear Systems
Linear Systems
Quadratic Formula
Quadratic Formula
Absolute Value
Absolute Value
Quadratic Inequality
Quadratic Inequality
Polynomial calculators
Binomial Theorem
Binomial Theorem
Square root and nth root calculators
Simplify Radicals
Simplify Radicals
Nth Root
Nth Root
Exponent and logarithm calculators
Exponents
Exponents
Log Calculator
Log Calculator
Number of Digits
Number of Digits
Scientific Notation
Scientific Notation
Sci. Notation Math
Sci. Notation Math
Half-Life
Half-Life
Complex number calculators
Complex Numbers
Complex Numbers
Polar Form
Polar Form
De Moivre
De Moivre
Function and graph calculators
Slope Calculator
Slope Calculator
Linear Function
Linear Function
Direct & Inverse Variation
Direct & Inverse Variation
y = ax² Calculator
y = ax² Calculator
Distance Formula
Distance Formula
3D Distance
3D Distance
Section Formula
Section Formula
Point to Line
Point to Line
Lat/Long Distance
Lat/Long Distance
Complete the Square
Complete the Square
Circle Equation
Circle Equation
Conic Sections
Conic Sections
Polar Coordinates
Polar Coordinates
Sequence calculators
Arithmetic Sequence
Arithmetic Sequence
Geometric Sequence
Geometric Sequence
Fibonacci Sequence
Fibonacci Sequence
Recurrence Relation
Recurrence Relation
Vector calculators
Vector Calculator
Vector Calculator
Cross Product
Cross Product
Matrix calculators
Matrix Calculator
Matrix Calculator
Determinant
Determinant
Inverse Matrix
Inverse Matrix
Plane geometry calculators
Sin Cos Tan
Sin Cos Tan
Degrees ⇔ Radians
Degrees ⇔ Radians
a sin θ + b cos θ
a sin θ + b cos θ
Triangle Solver
Triangle Solver
Triangle Area
Triangle Area
Right Triangle
Right Triangle
Pythagorean Theorem
Pythagorean Theorem
Polygon Angles
Polygon Angles
Scale Factor
Scale Factor
Parallel Lines
Parallel Lines
Rectangle Area
Rectangle Area
Parallelogram Area
Parallelogram Area
Trapezoid Area
Trapezoid Area
Circle Calculator
Circle Calculator
Sector Area
Sector Area
Inscribed Angle
Inscribed Angle
Ellipse Area
Ellipse Area
Solid geometry calculators
Cube Volume
Cube Volume
Cube Surface Area
Cube Surface Area
Box Volume
Box Volume
Box Surface Area
Box Surface Area
Cylinder Volume
Cylinder Volume
Cylinder Surface
Cylinder Surface
Sphere Volume
Sphere Volume
Sphere Surface
Sphere Surface
Spherical Cap Volume
Spherical Cap Volume
Cap Surface Area
Cap Surface Area
Ellipsoid Volume
Ellipsoid Volume
Ellipsoid Surface
Ellipsoid Surface
Pyramid Volume
Pyramid Volume
Pyramid Surface
Pyramid Surface
Cone Volume
Cone Volume
Cone Surface Area
Cone Surface Area
Frustum Volume
Frustum Volume
Frustum Surface Area
Frustum Surface Area
Pipe Volume
Pipe Volume
Capsule Volume
Capsule Volume
Capsule Surface Area
Capsule Surface Area
Date and time calculators
Age Calculator
Age Calculator
Days Between Dates
Days Between Dates
Date Calculator
Date Calculator
Hours From Now
Hours From Now
Day of the Week
Day of the Week
Time Calculator
Time Calculator
Time Zone Converter
Time Zone Converter
Hours Calculator
Hours Calculator
Time Duration
Time Duration
Time Card
Time Card
Finance and economics calculators
Compound Interest
Compound Interest
Simple Interest
Simple Interest
Interest Calculator
Interest Calculator
TVM Calculator
TVM Calculator
Present Value
Present Value
Future Value
Future Value
ROI Calculator
ROI Calculator
IRR Calculator
IRR Calculator
Payback Period
Payback Period
Average Return
Average Return
GDP Calculator
GDP Calculator
Web marketing and ad metric calculators
CTR Calculator
CTR Calculator
Conversion Rate
Conversion Rate
CPC, CPM & CPA
CPC, CPM & CPA
ROAS Calculator
ROAS Calculator
Break-Even CPA
Break-Even CPA
LTV Calculator
LTV Calculator
CAC Calculator
CAC Calculator
Churn Rate
Churn Rate
A/B Test Calc
A/B Test Calc
A/B Sample Size
A/B Sample Size
SEO Traffic
SEO Traffic
Break-Even Point
Break-Even Point
Markup vs. Margin
Markup vs. Margin
CAGR Calculator
CAGR Calculator
Health and fitness calculators
BMI Calculator
BMI Calculator
Sleep Calculator
Sleep Calculator
Calorie Calculator
Calorie Calculator
BMR Calculator
BMR Calculator
TDEE Calculator
TDEE Calculator
Ideal Weight
Ideal Weight
Body Fat Calculator
Body Fat Calculator
Lean Body Mass
Lean Body Mass
Calories Burned
Calories Burned
Protein Intake
Protein Intake
Macro Calculator
Macro Calculator
Carb Calculator
Carb Calculator
Fat Intake
Fat Intake
Child Height
Child Height
Sports calculators
Golf Handicap
Golf Handicap
Pace Calculator
Pace Calculator
1RM Calculator
1RM Calculator
Target Heart Rate
Target Heart Rate
Weather calculators
Heat Index
Heat Index
Wind Chill
Wind Chill
Dew Point
Dew Point
Computer calculators
Base Converter
Base Converter
Subnet Calculator
Subnet Calculator
Download Time
Download Time
Household energy and budget calculators
Electricity Cost
Electricity Cost
kWh to Cost
kWh to Cost
Yearly kWh to Cost
Yearly kWh to Cost
AC Size (BTU)
AC Size (BTU)
AC Running Cost
AC Running Cost
Heating Costs
Heating Costs
Gas vs Electric
Gas vs Electric
LED Savings
LED Savings
Salary Calculator
Salary Calculator
Budget Calculator
Budget Calculator
Car calculators
Trip Gas Cost
Trip Gas Cost
EV Charging Cost
EV Charging Cost
EV vs Gas Cost
EV vs Gas Cost
MPG Calculator
MPG Calculator
Tire Size
Tire Size
Solar power and battery calculators
Solar Output
Solar Output
Solar Panel Count
Solar Panel Count
Solar Payback
Solar Payback
Battery Size
Battery Size
Home and DIY calculators
Tile Calculator
Tile Calculator
Stair Calculator
Stair Calculator
Concrete Volume
Concrete Volume
Wall Area
Wall Area
Wallpaper Rolls
Wallpaper Rolls
Paint Calculator
Paint Calculator
Flooring Needed
Flooring Needed
Exterior Walls
Exterior Walls
Gravel Needed
Gravel Needed
Mortar Mix
Mortar Mix
Slope Grade
Slope Grade
Lumber Cut List
Lumber Cut List
Lot Coverage/FAR
Lot Coverage/FAR
Sheet Vinyl Roll
Sheet Vinyl Roll
Insulation Needed
Insulation Needed
Curtain Size
Curtain Size
TV Size & Distance
TV Size & Distance
Soil Needed
Soil Needed
Sod Needed
Sod Needed
Block Calculator
Block Calculator
Brick Calculator
Brick Calculator
Deck Materials
Deck Materials
Ramp Length
Ramp Length
Pilot Hole Size
Pilot Hole Size
Room Ventilation
Room Ventilation
Paint Thinning
Paint Thinning
Baseboard & Trim
Baseboard & Trim
Blind Size
Blind Size
Picture Hanging
Picture Hanging
Drain Slope
Drain Slope
Screw Calculator
Screw Calculator
Board Feet
Board Feet
Fence Calculator
Fence Calculator
Wood Shrinkage
Wood Shrinkage
Caulk Calculator
Caulk Calculator
Heat Loss
Heat Loss
Furniture Fit
Furniture Fit
Moving Boxes
Moving Boxes
Storage Capacity
Storage Capacity
Plywood Cuts
Plywood Cuts
Shelf Sag
Shelf Sag

ROI Calculator (Return on Investment and Annualized ROI)

Enter the amount invested and the amount returned (the money you got back). Set the period by dates or in years, and the gain or loss, ROI (return on investment) and annualized ROI are calculated together.

Enter amounts in dollars as plain numbers. It also works when the amount returned is smaller than the amount invested (a loss). If you only need the ROI, any period (for example, 1 year) is fine.
Result and graph
Enter the amount invested and the amount returned on the left and press "Calculate". The result and a graph will appear here.

What you can do on this page

  • Enter the amount invested and the amount returned, and get the gain or loss, ROI (return on investment), annualized ROI and investment period all at once
  • Set the period either by dates (start date and end date) or by length in years (decimals such as 2.5 years are fine)
  • Investments held for different lengths of time can be compared on the same scale, "% per year", with annualized ROI
  • Includes a bar chart that shows the gain or loss at a glance, an explanation of the formulas, and copy-and-paste formulas for Excel, Google Sheets and Python
ROI here is a math calculation that does not include fees or taxes. What you actually keep from a real investment changes by the trading fees and taxes. This page is for calculating and learning and does not recommend any investment.

What is this calculation used for?

Deciding on an equipment purchase (manufacturing, restaurants and more)

"If we buy a $30,000 machine, cost savings and extra sales should bring back $45,000 in total over 5 years." Treat that $45,000 as the amount returned: the ROI is \((45000 - 30000) \div 30000 = 0.5\) (50%), or about 8.4% a year annualized.
ROI is a standard input when a company approves equipment or system purchases. Future profits are only estimates, though, so it is good practice to also run the numbers with a cautious estimate.

Measuring advertising results (marketing ROI)

If you spend $10,000 on ads and the gross profit from those ads is $15,000, the marketing ROI is \((15000 - 10000) \div 10000 = 0.5\) (50%).
In online advertising, the basic approach is to move budget toward campaigns with a positive ROI. Just be careful to calculate with profit (revenue minus the cost of goods, that is, gross profit), not revenue, or you will overestimate the effect.

Getting a feel for the return on education

If you take a $3,000 course, earn a certification, and your salary goes up by $5,000 in a new job, the ROI is about 67% from the first year alone. "Investing in yourself" can be pictured with the same formula.
Of course, raises and passing exams are not guaranteed, and knowledge and confidence have value that does not show up in dollars. Use the number as a calm guide to whether the cost seems worth it.

How ROI relates to rental property yield

If a $300,000 property brings in $18,000 of rent a year, \(18000 \div 300000 = 0.06\) (6%) is its gross rental yield. This is the income per year as a share of the amount invested, a relative of annualized ROI.
ROI looks at the total over the whole period, while yield looks at one year from the start. Gross yield does not include property management, repairs, taxes, insurance or vacancies, so what you actually keep is less. (Investors use the cap rate, based on net operating income, to include those costs.)

Comparing investments held for different lengths of time

Fund A returned +30% in 3 years and fund B returned +45% in 5 years. Which did better? By ROI alone B wins, but annualized, A earned about 9.1% a year and B about 7.7% a year, so A did better per year.
Results over different lengths of time can only be compared fairly after you turn them into annualized ROI. Keep in mind that past performance does not guarantee future results.

Formulas and figures

Formula for ROI (return on investment)
Figure
Standard notation (the usual math form)
\(\mathrm{ROI}\) \(=\) \((\) \(R\) \(-\) \(C\) \()\) \(\div\) \(C\)
In words (symbols replaced with words)
④ ROI: return on investment \(=\) \((\) ① \(R\): amount returned \(-\) ② \(C\): amount invested \()\) \(\div\) ③ \(C\): amount invested
The formula in words
① From the \(R\): amount returned
② subtract the \(C\): amount invested to get the gain or loss
③ divide it by the \(C\): amount invested
④ and you get the ROI: return on investment (multiply by 100 to write it as a %)
Quick example
If you invest $10,000 and get $15,000 back, the ROI is
ROI: return on investment \(=\) \((\) amount returned ($15,000) \(-\) amount invested ($10,000) \()\) \(\div\) amount invested ($10,000)
\((15000 - 10000) \div 10000 = 5000 \div 10000 = 0.5\ \ (50\%)\)
Key idea
ROI is the percentage of profit compared with the money you invested. As math, it is exactly the same as a percentage change (a rise or fall in value), with "old value" replaced by the amount invested and "new value" by the amount returned (see "Percentage Change Calculator" in the related pages). If the amount returned is smaller than the amount invested, both the gain and the ROI are negative (a loss).
Annualized ROI (ROI per year)
Figure
Standard notation (the usual math form)
\(G\) \(=\) \(R\) \(\div\) \(C\)
\(A\) \(=\) \(G\) \(1/n\) \(-\) \(1\)
In words (symbols replaced with words)
③ \(G\): growth multiple \(=\) ① \(R\): amount returned \(\div\) ② \(C\): amount invested
⑤ \(A\): annualized ROI \(=\) \(G\): growth multiple ④ to the power \(1/n\) \(-\) \(1\)
The formula in words
① Divide the \(R\): amount returned
② by the \(C\): amount invested
③ to get the \(G\): growth multiple (how many times the money grew)
④ raise it to the power \(1/n\) (\(n\) = years invested) to turn it into a growth factor per year
⑤ then subtract 1 (the original money), and you get the \(A\): annualized ROI (multiply by 100 to write it as a %)
Quick example
If $10,000 grows to $20,000 (2 times) in 2 years, the annualized ROI is
growth multiple (2) \(=\) amount returned ($20,000) \(\div\) amount invested ($10,000)
\(A\): annualized ROI \(=\) growth multiple (2) to the power \(1/2\) (for 2 years) \(-\) \(1\)
\(20000 \div 10000 = 2\)
\(2^{1/2} = \sqrt{2} \approx 1.414\)
\(1.414 - 1 = 0.414\ \ (41.4\%)\)
Key idea
ROI has one weakness: it ignores time. "ROI of 100% in 10 years" and "ROI of 100% in 1 year" are very different, yet the ROI number is the same. Annualized ROI fixes this: it is the % per year you would get if the money grew by the same factor every year (averaging the yearly factors by multiplication, the idea of a geometric mean). Always use it when you compare investments held for different lengths of time. Raising to the power \(1/n\) finds the number that gives the original number when raised to the power \(n\) (the \(n\)th root). In the example, \(2^{1/2}\) is "the number that gives 2 when squared" = \(\sqrt{2} \approx 1.414\).
Formula for the years invested from dates
Figure
Standard notation (the usual math form)
\(n\) \(=\) \(d\) \(\div\) \(365.25\)
In words (symbols replaced with words)
② \(n\): years invested \(=\) ① \(d\): number of days \(\div\) \(365.25\)
The formula in words
① Divide the \(d\): number of days by the average length of a year, 365.25 days
② and you get the \(n\): years invested
Quick example
If you invest on January 1, 2026 and get your money back on July 1, 2026 (181 days later), the years invested are
\(n\): years invested \(=\) number of days (181) \(\div\) \(365.25\)
\(181 \div 365.25 \approx 0.496\)
Key idea
To even out leap years (once every 4 years, a year has 366 days), it is common to divide by 365.25 instead of 365. When the period is longer than 1 year, this page counts whole years up to the same calendar date as exact years, and converts only the remaining days (less than 1 year) with this formula. For example, from January 1, 2020 to January 1, 2023 is exactly 3.000 years.
ROI, found as "gain or loss ÷ amount invested", is the report card of an investment. But it ignores time, so when you compare investments held for different lengths of time, compare their annualized ROI (the growth turned into a factor per year).

Symbols and terms

Symbols

ROI R O I Return on investment. The gain or loss as a % of the money invested. (Example - if $10,000 becomes $15,000, the ROI is 50%.)
\(C\) C The amount invested (cost). All the money you put into the investment.
\(R\) R The amount returned. All the money that finally came back from the investment, such as the sale price and distributions (the whole amount, including your original money, not just the profit).
\(G\) G The growth multiple. How many times the amount invested grew (\(R \div C\)). (Example - $10,000 → $15,000 is 1.5 times.)
\(n\) n The years invested. The time from investing to getting the money back, in years; it can be a decimal such as 2.5 years.
\(d\) d The number of days from the start date to the end date. Divide by 365.25 to turn it into years.
\(A\) A Annualized ROI. The ROI turned into "% per year", used to compare investments held for different lengths of time.
\(G^{1/n}\) G to the one over n The growth multiple \(G\) to the power \(1/n\): the number that gives \(G\) when raised to the power \(n\), which is the average growth factor per year. (Example - doubling in 2 years is \(2^{1/2} \approx 1.414\) times per year.)

Terms

ROI (return on investment) The profit on an investment as a share of the money invested. It is found as "gain or loss ÷ amount invested" and written as a %. It is one of the most widely used measures in business.
annualized Restated as "% per year", so that results over different lengths of time can be compared fairly. Financial documents may call it the annualized return or CAGR (compound annual growth rate).
geometric mean An average taken by multiplication. Unlike the usual average (the arithmetic mean: add up and divide), you multiply all \(n\) numbers together and raise the product to the power \(1/n\). It is the right average for amounts that build up by multiplication, such as growth factors and growth rates.
nth root The number that gives a given number when raised to the power \(n\). It can be written as the power \(1/n\). (Example - the cube root of 8, \(8^{1/3}\), is the number that gives 8 when cubed, which is 2.)
marketing ROI ROI that treats advertising and promotion spending as an investment. It is "(profit added by the ads − ad spend) ÷ ad spend". Be careful to use profit (gross profit), not revenue, or you will overestimate the effect.
yield The income per year as a share of the amount invested. ROI looks at the total over the whole period, while yield looks at one year from the start. It is used for rental property and bonds, and is a relative of annualized ROI.

Good to know before you start

Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.

Percents (Grades 6–7)
  • Knowing that a percent is found as "part ÷ whole"
  • Being able to switch between decimals and percents, such as 0.5 and 50%
Positive and negative numbers (Grades 6–7)
  • Writing a loss as a negative number
  • Knowing that a negative number divided by a positive number is negative
Exponents and roots (Grade 8 to Algebra 2)
  • Knowing that a power is repeated multiplication of the same number, as in \(2^3 = 2 \times 2 \times 2\)
  • Knowing that the power \(1/n\) finds the number that gives the original number when raised to the power \(n\) (the \(n\)th root; used in annualized ROI)

How to calculate it in Excel

Copy the whole table below and paste it into cell A1 in Excel. It works as is.
Table for ROI (return on investment)
Amount invested 10000
Amount returned 15000
ROI (%) =(B2-B1)/B1*100
Table for annualized ROI
Amount invested 10000
Amount returned 15000
Years invested 3
Annualized ROI (%) =((B2/B1)^(1/B3)-1)*100
Table for the years invested from dates
Start date 2026-07-03
End date 2030-12-31
Years invested =(B2-B1)/365.25
In the first table, enter the amount invested in B1 and the amount returned in B2, and B3 shows the ROI as a % number (the example shows 50, which is 50%).
The second table adds the years invested in B3 and gives the annualized ROI (about 14.47 in the example, 14.47% a year). "^" is a power, and "^(1/B3)" is the part that finds the number that gives the total growth when raised to the power B3 (the growth factor per year).
The third table subtracts one date from the other to get the number of days and divides by 365.25 to turn it into years (about 4.496 years in the example). If the result cell shows a date, change the cell format to Number. For periods of exactly a whole number of years, the result can differ from this page by about 1/1000 of a year because of leap years.

How to calculate it in Google Sheets

Copy the whole table below and paste it into cell A1 in Google Sheets. It works as is.
Table for ROI (return on investment)
Amount invested 10000
Amount returned 15000
ROI (%) =(B2-B1)/B1*100
Table for annualized ROI
Amount invested 10000
Amount returned 15000
Years invested 3
Annualized ROI (%) =((B2/B1)^(1/B3)-1)*100
Table for the years invested from dates
Start date 2026-07-03
End date 2030-12-31
Years invested =(B2-B1)/365.25
The same formulas as in Excel work as is. Copy the whole table, paste it into cell A1, and replace column B with your own numbers. Subtracting dates works the same way.

How to calculate it in Python

from datetime import date

invested = 10000   # amount invested ($)
returned = 15000   # amount returned ($)
years = 3          # years invested

gain = returned - invested                                # gain or loss
roi = gain / invested * 100                               # ROI (%)
annualized_roi = ((returned / invested) ** (1 / years) - 1) * 100  # annualized ROI (%)

print(f"Gain or loss: ${gain}")
print(f"ROI: {roi:.2f}%")
print(f"Annualized ROI: {annualized_roi:.2f}%")

# To set the period by dates, divide the number of days by 365.25 to get years
days = (date(2030, 12, 31) - date(2026, 7, 3)).days
years_from_dates = days / 365.25
print(f"Years invested: {years_from_dates:.3f}")
Runs with the standard library only. "**" is a power, and "** (1 / years)" is the part that turns the growth into a factor per year. Change the amount invested, amount returned and years at the top, then run it.

How to write it in LaTeX and other math languages (copy and paste)

Formula for ROI (return on investment)
ROI = (R − C) ÷ C
\mathrm{ROI} = \frac{R - C}{C}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>ROI</mi>
    <mo>=</mo>
    <mfrac>
      <mrow><mi>R</mi><mo>&#x2212;</mo><mi>C</mi></mrow>
      <mi>C</mi>
    </mfrac>
  </mrow>
</math>
ROI = (R - C) / C
(r - c)/c
ROI := (r - c)/c;
ROI = (r - c)/c;
ROI = (R − C)/C
Annualized ROI (ROI per year)
A = \left(\frac{R}{C}\right)^{1/n} - 1
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>A</mi>
    <mo>=</mo>
    <msup>
      <mrow>
        <mo>(</mo>
        <mfrac><mi>R</mi><mi>C</mi></mfrac>
        <mo>)</mo>
      </mrow>
      <mrow><mn>1</mn><mo>/</mo><mi>n</mi></mrow>
    </msup>
    <mo>&#x2212;</mo>
    <mn>1</mn>
  </mrow>
</math>
A = (R/C)^(1/n) - 1
(r/c)^(1/n) - 1
A := (r/c)^(1/n) - 1;
A = (r/c)^(1/n) - 1;
A = (R/C)^(1/n) − 1
Formula for the years invested from dates
n = d ÷ 365.25
n = \frac{d}{365.25}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>n</mi>
    <mo>=</mo>
    <mfrac>
      <mi>d</mi>
      <mn>365.25</mn>
    </mfrac>
  </mrow>
</math>
n = d / 365.25
d/365.25
n := d/365.25;
n = d/365.25;
n = d/365.25

How to have ChatGPT  do the calculation

You are an investment calculation assistant. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing).

I invested $10,000, and 3 years later I got $15,000 back.
Find each of the following:
1. The gain or loss (in dollars)
2. The ROI (return on investment, in %, to 2 decimal places)
3. The annualized ROI (in %, to 2 decimal places) = (amount returned ÷ amount invested) to the power (1/years) − 1

Show the formulas you used and the numbers from the execution result.

How to Use
  1. 1
    Enter your numbers
    Type the numbers you want to calculate with into the input fields
  2. 2
    Calculate
    Press the "Calculate" button
  3. 3
    Check the result
    The result appears on the spot. The same page also explains the idea behind the calculation and the formula
  DataChef Features
Easy and Free
Unlimited conversions for free.
No technical knowledge required.
Intuitive and user-friendly operation.
No Registration Required
Available immediately after access.
Can be used without registering personal information.
Safe and Secure
Fully SSL encrypted communication.
Automatic file deletion by clicking "download".
Fast
High-speed site access
and rapid file conversion.
No Watermark
No watermark.
No attribution required.
Commercial Use Available
Free for commercial use.
No need to contact us for commercial use permission.