ROI Calculator Widget

Add an ROI calculator to your site. Readers enter what they invested and what they got back and see the return on investment, the gain or loss and, if they add the holding period, the annualised return.

Finance Calculator Runs in your browser Free · no ads

Customize your widget

Theme
Auto follows the visitor's light/dark setting.
Style
Attribution on your page
The widget is free; a visible credit is how you can say thanks. It is one plain line, shown in the code below, linking to the tool with rel="nofollow". Switch it off here or delete the line - the widget works the same either way.
More options
Starting values
Leave blank to use the widget's defaults. Visitors can still change every value.

Live preview

Exactly what your visitors will see

Under the widget on your page: ROI Calculator by A2Z Tools

Embed code

<div data-a2z-widget="roi-calculator" data-height="480"></div>
<p class="a2z-attribution" style="margin:6px 0 0;font:12px/1.4 system-ui,sans-serif;opacity:.8">ROI Calculator by <a href="https://a2z.tools/roi-calculator" target="_blank" rel="nofollow noopener">A2Z Tools</a></p>
<script async src="https://a2z.tools/embed.js"></script>

Recommended. A small script (what it does) sizes the widget to fit its content, loads it lazily and keeps it isolated in its own frame. Works in WordPress (Custom HTML block), Squarespace, Webflow, Shopify, Blogger, React / Next.js and plain HTML - anywhere a <script> tag is allowed.

Works with

Advertisement

How it works

The widget uses the same formula as the A2Z ROI Calculator: the gain divided by the amount invested. Because a 25% return over two years is not the same as 25% in one, the optional holding period turns the total into an annualised rate so investments of different lengths can be compared. Leave the period blank for a one-off campaign or purchase where only the overall percentage matters; a loss is labelled as such rather than shown as a negative gain.

Calculation method

  • ROI = (returned - invested) / invested x 100
  • Annualised ROI = (returned / invested)^(1 / years) - 1
  • Rounding: money to 2 decimals, percentages to 2 decimals

Worked examples

A two-year holding

Inputs: Invested 10,000; returned 12,500; 2 years

Result: ROI 25%; net gain 2,500.00; annualised 11.8% a year

1.25 to the power 1/2 is 1.118.

A losing trade

Inputs: Invested 8,000; returned 7,200; no period

Result: ROI -10%; net loss 800.00

Without a period, no annualised figure is shown.

Comparing two holdings

Inputs: 10,000 to 15,000 over 5 years vs 10,000 to 13,000 over 1.5 years

Result: ROI 50% (8.45% a year) vs ROI 30% (19.11% a year)

The smaller total return is the better yearly result.

Limitations

  • Ignores the timing of intermediate cash flows, taxes and inflation.
  • Does not adjust for risk; two investments with the same ROI can carry very different risk.
  • Holding periods are entered in years; exact dates, leap years and partial months are not counted.

Where publishers use it

  • Marketing and small-business blogs judging a campaign or purchase
  • Property flippers and landlords summarising a deal
  • Investing guides comparing two holdings of different lengths
  • Training course pages on basic financial ratios
  • Equipment, solar and energy-efficiency retrofit pages justifying an upgrade by its payback

Questions

What should go in 'amount returned'?

Everything you got back: the sale proceeds plus any dividends, interest or rent received, after selling costs and commissions.

Why annualise?

Annualising puts returns on the same per-year footing. 25% over 2 years is about 11.8% a year, which you can compare with a savings rate or another investment.

Does ROI account for risk or timing of cash flows?

No. For several deposits and withdrawals at different times, an IRR calculation is more accurate.

Why does a shorter holding period raise the annualised figure?

The same gain earned faster compounds into a higher yearly rate: 30% over 18 months is 19.11% a year, while 50% over 5 years is only 8.45% a year.

Is ROI the same as ROAS or profit margin?

No. ROI divides the net gain by the cost; ROAS divides ad revenue by ad spend without subtracting costs; margin divides profit by the selling price. A campaign can show 300% ROAS and still a negative ROI once product costs are counted.

How do I include costs I paid along the way?

Add them to the amount invested: purchase price plus brokerage, stamp duty, renovation or listing fees. ROI is only as honest as the costs you include, and leaving them out is the most common way it gets overstated.

Cite or recommend this tool

If you reference this tool in an article, course or documentation, these formats are ready to copy. They are optional - nothing is added to your site unless you paste it.

A2Z Tools ROI Calculator
https://a2z.tools/roi-calculator

Preview

Advertisement