S&P 500 Periodic Reinvestment Calculator (With Dividends)

Written by:

Below is a S&P 500 Periodic Reinvestment Calculator. It allows you to run through investment scenarios as if you had been invested in the past. It includes estimates for dividends paid, dividend taxes, capital gains taxes, management fees, and inflation.

The S&P 500 Periodic Investment Calculator

Basic Options for the S&P 500 Periodic Reinvestment Calculator

  • Starting Month & Year - When to start the scenario.
  • Ending Month & Year - When to end the scenario.  This field will default to the most recently updated month. Please see notes on the S&P 500 Reinvestment Calculator for details on what that means for specific dates
  • Starting Amount ($) - A lump sum value invested only once at start.
  • Monthly Investment ($) - A periodic, monthly investment. It is not applied in the first month, but applies every month thereafter. (Note that the next field changes the behavior drastically.)
  • How to Change Monthly Investment?
    • Keep it Constant - Every month will use the same investment amount.
    • Increase it by Inflation - Increases the monthly investment by inflation (CPI) (see Robert Shiller's site for details). You can choose if the investment amount is the terminal or the starting amount.
    • Increase it by (x)% Monthly - This field increases the monthly investment by a constant amount.  (The default is .0829% a month, or 1% annually)
    • Custom (Advanced Section) - Please see the Advanced Section below for details. If you'd like, you can set every monthly investment manually no longer the timeframe.
  • Buttons
    • Calculate - Calculate the investment performance with the currently selected options. (Run this first).
    • Reset - Reset all fields to calculator defaults.
    • Download CSV - After 'Calculate' is run, export all of the monthly data to a spreadsheet in csv format. It includes some internal values which show the amount lost to taxes and fees monthly, and shows a running total of the portfolio value.
    • Show Graph - After 'Calculate' is run, plot a simple graph of the running total portfolio value by month.
  • Outputs
    • Final Value of Portfolio ($) - The final portfolio value before sales are made.
    • Annualized Return (XIRR - $) - The internal rate of return for the cash flows implied by the inputs. If monthly investments are set to '0', this will be based on the original purchase.
    • Total Invested (Cost Basis - $) - The amount invested, in total, as an input to XIRR and (optional) as an input to the capital gains calculation.  This includes lump sums, monthly investments, and dividends reinvested (net of taxes).
    • Value After Capital Gains Tax ($) (OPTIONAL) - If the capital gains tax in Advanced Options is set greater than 0%, this field will estimate the value of the portfolio after selling it all as a lump sum.
A screenshot of the S&P 500 Periodic Investment calculator's advanced options
Advanced Options for the S&P 500 Dividend Reinvestment and Periodic Investment Calculator

Advanced Options for the S&P 500 Periodic Reinvestment Calculator

Click the button labeled 'Click to Show Advance' to show the tool's advanced options.

  • Taxes - options for dividend tax treatment
    • Ignore Taxes - disregards taxation on monthly dividend payments
    • Count Estimated Taxes - changes taxes on monthly dividend payments based on the tax rates in the 'Custom Dividend Tax Entry' box as explained below.
  • Management Fees - options for management fees (also see our mutual fund fee calculator)
    • Ignore Fees - disregards management fees
    • Count Estimated Taxes - charges a monthly management fee as specified in the 'Custom Management Fee Entry' box as explained below.
  • Capital Gains Tax Rate (%) - a percentage tax to apply to estimate the value of the portfolio if it is sold in a lump sum at the scenario's conclusion.

Tool Default Overrides

These fields are pre-populated by the tool and we have no way to save your inputs on the server. Please make sure you back them up – paste them somewhere – if you are running a complex scenario!

The tool's designed for you to set up your own defaults as two columns in your favorite spreadsheet program, then just select both columns and paste directly into the tool's text box:

  1. The date must be in the format: MM-DD-YYYY.
  2. The date must be followed by a tab or whitespace character.
  3. The whitespace must be followed by a value which applies to that date forward, inclusive of the date.
  • Custom Dividend Tax Entry
  • Custom Management Fee Entry
    • Defaults are courtesy this Vanguard statement, extrapolated forward from 1975 and backwards with 1.5% arbitrarily chosen as the starting annual management cost in 1871.
  • Monthly Investment Entry
    • If (and only if) you choose 'Custom (Advanced Section)' in the 'How to Change Monthly Investment?' field of the basic options, this table's month and year will be used to set the periodic investments.
    • If active, only the months listed will be used in the calculations, so it can be used to model annual or quarterly investments, as well as (or in addition to) one time lump sum investments.

Methodology for the S&P 500 Periodic Reinvestment Calculator

The tool uses data published by Robert Shiller, which you can find here. Our S&P 500 methodology from our S&P 500 Reinvestment Calculator and Dow Jones Industrial Average Reinvestment Calculator is repeated; please read those articles if you are interested in the return calculations.

On top of the above features, we've added periodic investments, dividend taxes, capital gains taxes, graphing, and exporting results in monthly resolution. 

Monthly Investment Methodology

Here is our order of operations for every month other than the first month.  In the first month, we buy shares at the market price using the lump sum, receive no dividends, and pay no fees or taxes)

  1. Calculate dividends paid based on running total of shares
  2. IF there are dividend taxes for that year and IF the user hasn't checked 'Ignore Taxes'
    1. Pay taxes on the dividends earned
    2. Calculate amount left over (do not buy more shares yet)
  3. IF there are management fees for the month and IF the user hasn't checked 'Ignore Fees'
    1. Pay fees on the running total of shares
    2. Decrease the running total of shares
  4. Buy more shares with the dividend amount from step 2/2 at the current market price
    1. Add this amount to the running total 'dividend basis'
    2. Add number of shares to running total
  5. IF the user wants us to invest monthly
    1. Buy shares at the current market price, add number of shares to running total
    2. Add this amount to the running total 'cost basis'

Final Month Investment Methodology

When we hit the closing month:

  1. Calculate the final portfolio value:
    1. Running number of shares * market value on closing month
  2. Calculate XIRR based on investment amounts and timing.  Does not factor in capital gains, if any.
  3. (Optional) If capital gains are set, calculate theoretical value of portfolio if sold as a lump sum
    1. Calculate cost basis
      1. Lump sum + running total of cost basis from monthly investments + running total of dividend investments
    2. Calculate capital gains tax on capital gains
      1. (Final value - Cost Basis) * (100% - Capital Gains Rate)
    3. Output value of portfolio
      1. Final value - capital gains tax

Now that you've seen our methodology, a disclaimer:

Everything about this tool is informational and all outputs and calculations are for research purposes only.  McGraw Hill Financial owns the S&P 500 Index and decides its constituent members, you should defer to them for all exact numbers, timings, and dates.

Double check all numbers output from the tool with your own calculations using source data from elsewhere. We've made every effort to present accurate information, but this calculator is maintained by a single hobbyist.

There are likely errors and omissions in the data. Even when the data is accurate, choosing different timings and orderings for the steps listed above can meaningfully change the final results of the calculations. Proceed at your own risk.

FAQ on the Periodic Reinvestment Tool

Data Questions

How often do you update the data?

You can check the last updated month by seeing what was set when you opened the page.  It should automatically go to the latest data.

Unfortunately, we have to update manually (for now) so expect about once a month updates. We have a number of calculators pointing to the same file, so when I update one they all pick up the new data automatically; we don't have to touch each one individually:

If you come back and the default dates have changed, you'll know it has recently been updated.

Why is the data in monthly format? Can you add daily data?

Robert Shiller is our source, and his methodology can be found on his site. This data is reasonably accurate and I trust it, but it isn't exact and official. 

McGraw Hill Financial owns the S&P 500 Index; if you want more specific data on dividend timing or daily data you should seek it out from them.

How does this dataset start from before the S&P 500 Index Began?

See Robert Shiller's site (one question above). Dates before the index are spliced to indexes which reasonably measure similar stocks. 

If you really don't like it, you can limit your analysis to more recent years.

I don't like your management fee estimates/tax estimates. Can you change them?

No, but you can.  It is very easy to fill the custom advanced option fields when you use a spreadsheet program to set it up. 

Here's what I use (OpenOffice) - it's free. I used it to test this calculator (on a Mac), so I can vouch for it. Just paste into the fields in the advanced options.

My preferred investment style is (annually/quarterly/biannually/only on leap years/once per child I have), can you add it to the tool?

No, but you can.  Try OpenOffice - it's free or Excel to lay out the dates for easy cut/paste into the tool.

See the above answer, and note that when you do custom investment amounts the tool will only fill in investment amounts of the months you enter, so you can do as many or as few as you want!

Are the default management fees accurate?

There are so many index funds with so many different management fees that it's impossible to have a good number.  These are a reasonable start, but even today there is a huge disparity in what different funds cost to manage an index fund.  Just change them if you don't like them, or start from a later date when they better match your expectations.

How do you have management fees before 1971 when the first index funds were forming?

No idea - I assume that would be the tracking error and management fee cost of large funds mimicking indexes or something.  I made them up.  I'm sure a large investor could pay a manager to track an index as well (or buy every stock in an index), but I agree it's not perfect - most of what we know about indexing is only a generation and a half old.

How precise is this tool?

All internal data is rounded off to 4 decimal places.  (If you can't match a calculation exactly, that's the most likely culprit). 

The results are approximate anyway so this isn't a huge limitation. Still, please keep it in mind while citing and using the calculator.

General Questions

Can you add <some feature I think is important> to the tool?  Can you add other asset classes or indexes?


I'm available for hire if you need something custom, with this data or most any other data I have access to. The tool is in a state which makes me happy.  Feel free to leave suggestions, but this is probably the final number of features that will ever be in this calculator. To project into the future, try the investment calculator instead.

Here's some other work I've done... maybe I've already created what you need?

Can you fix the bug with <something I think is broken>?

Yes, absolutely... and please bring it up immediately so I can fix the tool!

However, if you're trying to sneak in an enhancement request, the answer is 'no' (or 'hire me').


Why did you make this?

Consider it a reverse birthday gift - the site turned 6 years old, so you got a gift!

Also, I wanted to run a lot of these scenarios myself, and you've already seen the beginnings of this calculator take shape in an article or two. Why not?

How long did this take to create?

The code probably took 10 or 15 hours (I don't have an exact number - it's about 1300 lines of code all in). All the miscellaneous stuff like writing this article and finding source data and defaults probably added another 5-8. 

With that in mind, please share this piece with all of your friends!

What was this calculator written in (and on)?

Pure JavaScript. I used some new HTML features too for the csv export, and I use Google's library for the chart

I started it on a 2012 Macbook Pro 15", and I'm finishing up with a Mid-2014 Macbook Pro 15" Retina.

Conclusion for the S&P 500 Periodic Reinvestment Calculator

So, we've addressed many of the limitations in the S&P 500 reinvestment calculator with this post. Now you can run wild with all of your backtesting questions on the S&P 500. 

I hope that this covers everything you wanted with the original tool, and additionally silences the few rumblings I still see about passive investing. Now you can run the scenario you'd like here for periodic vs. lump sum investing and see a reasonably accurate backtest.

The CSV file export is another key feature. By exporting the data monthly, you can import it into your spreadsheet program and run even more complex scenarios.

Also, as we showed in the original calculator, dividends matter. Over longer scenarios, you'll note that the dividends paid start to dominate the initial investment. If you ever see an article posted which ignores the effects of dividends or only quotes price returns on an index, please send the author this way!



PK started DQYDJ in 2009 to research and discuss finance and investing and help answer financial questions. He's expanded DQYDJ to build visualizations, calculators, and interactive tools.

PK lives in New Hampshire with his wife, kids, and dog.

Don't Quit Your Day Job...

DQYDJ may be compensated by our partners if you make purchases through links. See our disclosures page. As an Amazon Associate we earn from qualifying purchases.
Sign Up For Emails
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram