In my previous post, I talked about something I call the “*Stop Investing”* number. Your *Stop Investing* number is the amount of money you need right now to hit a target net worth in the future, **without investing anymore money**. You may realize that you’ve already hit this, and it’s smooth sailing! But what if you’re just getting started, and you want to know how much money to invest each month to hit a target net worth? The math behind this is significantly more complex, but I’ve got you covered!

*At the end of this post, I have a chart that shows you exactly how much money to invest per month to hit your net worth goal. If you want to skip past all the math, just scroll to the bottom.*

## How Much Should You Invest?

Okay, so let’s say that you want $1 million dollars in the next 20 years. How much should you invest in the stock market every month to hit that goal? This is an age-old question, and figuring out the answer isn’t so easy. Your gut might say $1,000,000 / 240 = **$4,167**, but you’re wrong, you can save less than half that and achieve your goal. The real answer is: **$1,899.76**. But how did I get that number?

Unfortunately, there isn’t a *easy* answer. To figure this out, we’re going to have to do a little math. Don’t worry, I’ll fill you in with the details later. But before we tackle this problem, we need to try an easier one.

The easier problem will be to calculate the *future value* of your portfolio, given you make a recurring monthly deposit. Let’s say that you invest a certain dollar amount every month. How much will it be worth in the future? Remember, when you invest money, it will increase and decrease in value due to fluctuations in the stock market. That’s why we couldn’t do $1,000,000 / 240 = $4,167 before.

To calculate the future value of your portfolio, all it takes is a few variables and a little bit of High School math.

In this scenario, you are making a recurring deposit for some number of years. You start out with an initial investment *PV*, which stands for **p**resent **v**alue. Given these inputs, we can calculate the *FV — *or **f**uture **v**alue — of the investment.

d = recurring deposit amount

t = time in years

r = interest rate

PV = present value

FV = future value

Given these inputs, we can easily calculate the *FV*.

This may not be trivial, but it isn’t calculus (thankfully). The *future value* equation has two main components.

The first is the compounding effects on your *present value *(). This is the investment gain from leaving your current portfolio invested in the market for t years.

The second component is the increased value from making your monthly recurring deposit, and applying compound interest r over k years (). This calculation is very sophisticated, because it correctly takes into account how long each recurring deposit was invested.

The thing is, now we have a problem. We want to calculate *d*, which is our recurring monthly deposit. This represents how much you need to invest every month to hit your net worth goal. So can you easily solve for *d*? Unfortunately, we can’t.

I totally understand that this seems a bit complex. Most of us haven’t used much math since we graduated from High School. However, what we’ve done is capture how to calculate future value in a fairly simple equation. We’ll use this formula to help us work backwards to figure out what our recurring monthly deposit should be.

Register for the October Zero Day Challenge Special Event!

In October, we're running an **exclusive** Zero Day Challenge event! Register now to start saving hundreds of dollars per month, plus we'll be giving out $250 in prizes!

## Let’s Calculate your Recurring Monthly Deposit

The takeaway from the first part of this post is that we can’t easily calculate our recurring monthly deposit. However, we can calculate the future value pretty easily. We’ll use this to our advantage.

Wait a minute. If we can’t easily calculate recurring monthly deposit, how do so many people know how much money to invest? Well, there are 2 answers. The first is that they don’t actually know how much to invest, they just do as much as they can. The other scenario is that they used a strategy we all learned in Middle School: **guess and check**.

Instead of directly calculating what the monthly recurring deposit should be, just guess! We can guess a value for the recurring monthly deposit, plug it into the *FV* equation above, and see how close we get. Try $750, $850, $900, $915, $917, $917.50. At some point, you get to the right monthly contribution that has us achieve our goal.

Unfortunately, this isn’t easy. You could try tens, even hundreds of values before you hit your *FV*. So, how can we make this more efficient? By applying a little bit of algorithmic analysis, data structures, and software, we absolutely can.

### The Recurring Deposit Algorithm

To solve for *d*, we’re going to use a few semi-advanced Computer Science algorithms to help us out. In reality, they are methods we use **every day** without even breaking a sweat, like when we search for a word in a physical dictionary. Here is our process:

- Set minimum and maximum “guesses” for our recurring monthly deposit
- Pick the middle number inside our bounds; this will serve as our guess for the value of
*d* - Execute the
*FV*calculation using that guessed*d* - If our
*FV*is close enough to our goal, exit - Otherwise, reconfigure the bounds, and repeat steps 2-4

This seems like we’re still guessing, right? Well, you’re right: we are still guessing! The thing is, we are intelligently guessing. Think about what happens if you open up a physical dictionary, and are looking for the word “investment.” You open up the book and see the word “problematic.” Since “investment” comes before this, you look in the pages to the left. The next word you see is “carcinogenic.” Well, “investment” comes later in the alphabet, so we look to the right. This is the type of search pattern that our above algorithm uses.

What we’re actually doing is called a binary search. Without getting too much into the details, every time we guess the value of *d*, we get closer and closer to the correct answer. In fact, every time we guess incorrectly, we get twice as close to our solution.

Step 4 also says *close enough*. We won’t get an **exact** answer, but we will build in a margin of error. For example, we’re alright with all values of *d* that produce a *FV* within 1%, 0.1%, etc, of our target net worth. This lets us speed up the calculation significantly.

### Calculating Your Monthly Deposit

Now that we have an algorithm, we can write a simple piece of software to implement it. I wrote a python script that will do the calculation for you. It sounds really impressive, but it’s only about 25 lines of code. And I’m not really a software engineer by trade, so I bet somebody could shrink that down to 10 or 12 if they’re really good.

Anyway, here is the output of the program:

Interpreting this chart is very easy. Look at the row labeled $1,250,000.00. Now see where it intersects with the column labeled 40. The number inside that cell is $488.00. This means if you invest $488 every month for 40 years, you’ll have $1,250,000. See, easy!

These numbers are **very **interesting. I’ve seen a few sites that try and do this, but the numbers aren’t quite right, and they make it overly complex. You can use the above screenshot to see how much you need.

Anyway, I’m going to guess most of us want to retire with $1,000,000 in 20 years. I do run a **f**inancial **i**ndependene **r**etire **e**arly (FIRE) blog. To do that, we each need to invest $1,914.00 every single month for 20 years. Remember how I said you would need $1,899.74 at the beginning of the post? Well, that’s because I ran that number with a different margin of error. This discrepancy is due to accepting a 1% vs. 0.1% discrepancy between our desired net worth and the calculated net worth. In either scenario, the numbers are close enough, and the calculation will never be exact anyway.

We can also see how you can build $1.5 million in 40 years by investing $585 per month. For those of you who are looking to build a sizable net worth, be prepared to save a lot. Even if you want to invest for 40 years, investing $1,171 for 480 months isn’t trivial. And for those of us who want to save $3,000,000 in 10 years? Well, I hope you’re making at least $350,000 per year, otherwise it just won’t work.

One thing I will say is that everybody’s situation is different. Some of us have $0 invested, others hundreds of thousands of dollars. If you want to calculate your recurring monthly deposit *and* you’ve got some assets already, just comment with your situation (or start a conversation with me on Twitter!) and I’ll give you the numbers!

I can also send you a copy of the script. I don’t want to host a copy on my site, because distributing random code on the internet for people to run is not good, and I won’t encourage that type of behavior. Feel free to email me at *david[at]zerodayfinance[dot]com* and I’ll gladly send you the source code, plus how to run it. It’s actually really easy, especially if you have a Mac.

## Reduce Spending, Increase Savings

You might be thinking, “*jeez, I need to save a ton just to build up a nest egg large enough to retire!” *If this is the case, you have 2 options: increase your income, or reduce your spending. Increasing your income is the goal. If you can get a 10% raise, you can immediately apply that money towards your investments.

Unfortunately, most of us can’t just get a 10% raise. So what about reducing your spending? One of my friends over at CNBC Make it, Emmie Martin, has an awesome set of posts detailing how to save money. She just wrote an article that gives a few great examples of how to cut your expenses. I would definitely give it a read.

## Hit Your Goals

So, are you on track to hit your goals? Were you surprised by how much (or how little) you need to invest each month to hit your target net worth? I sure was! I hope this shows you that you can hit your investing goals with enough perseverance.

I now know that my investment goal is $4,384.77 per month. I’ve only invested that much maybe 3 or 4 months out of the past 4 years. But it’s a tough goal that I’m happy to chase, even if I rarely achieve it. I hope that you’re on track, or you’re making changes to be on track. If you want to find out how to decrease your spending, check out my Zero Day Challenge, which helped cut my spending by more than $1,500 per month!

Good Hunting,

David

To be honest I’m not 100% sure what our ‘MUST DO’ number is, but I know it’s lower than what we’re contributing. Plus we already have some investments which helps, but makes the math even more complex.

Overall I’m happy making the progress we are. The markets will do what they do, we just need to keep contributing and ride it out. Things WILL change but if we are persistent and consistent with our contributions, that’s all we can really do. Knowing we’re contributing more than we probably ‘need’ to to hit our goal will simply move our date up, rather than adjusting our spending now since we ‘could’.

Good insight here.

Thanks!

For me (and I’m guessing a lot of other people), their goals are “I want to retire by X age.” However, they don’t have a specific plan for retiring at that age. Hopefully with this information, they know exactly how much to contribute in order to hit their goals.

I love how simple you make this! It hurts me physically to know I basically ‘wasted’ my 20s by not saving in a retirement fund, but at least I can fix it going forward. But… what if part of your retirement plans include other sources of income? Continued part time work, businesses, rental properties? How does “retiring” early and starting withdrawals before 60 affect this? That is what makes calculating our expected FIRE number so hard… we will just keep banking 50% of our income, and see where the next few decades take us!

Saving 50% of your income is great!

So, you can actually deal with some of those variables you mention.

“What if part of your retirement plans include other sources of income?”This means you need to understand your retirement income requirements. For example, if you need $40,000 in passive income to retire, and you are expecting to earn $10,000 per year during retirement working odd jobs, then you only need $30,000 in passive income. Using the 4% safe withdrawal rate, you calculate that $750,000 will produce that $30,000 per year, so you can adjust your target.If you want to retire before 59.5, you need to execute a plan to access your tax-advantaged retirement funds. For example, you can start a Roth conversion ladder to access your Traditional IRA / 401(k).

I haven’t calculated how much I should be investing because I don’t know how much I need to end up with. I assume that my spending needs will change when kids enter the picture and I don’t know how much. My current plan is to invest as much as possible, which is working out well so far. I do make sure to invest at least as much as I spend every month, which provides a ceiling on lifestyle inflation.

Sounds like you have a 50% savings rate which is great! What you can do is multiply your monthly spending by 12, that will give you your minimum yearly spending. Now multiply that number by 25, and that’ll tell you how much of a nest egg you’ll need to generate that income, and voila!

Yeah, I’ve got that number figured out. I assume that my current spending will not be indicative of my future spending, though, as I am currently childless and living in a one-bedroom apartment and will have children and presumably space for them to live in the future 🙂

True, I’m in a similar situation. Living with parents with my fiancee before we get married. Expenses will significantly increase.

This is fantastic, thank you!

Could you extend the table to the 4 million mark? I’m curious to compare our numbers and make sure we’re calculating correctly. I think we are based on your other ranges – in fact I think we’re calculating growth a bit too conservatively.

Also, maybe I missed this, but what is the breakdown of assets in your hypothetical portfolio? I assume it’s heavily weighted toward stocks? What was the expected real return you used? Thanks!

The breakdown of assets would be a portfolio that can produce the input growth rate. I used a 7% growth rate, so that’s pretty aggressive, most likely 80/20 or 90/10 stocks to bonds. You’ll probably enjoy this… One Sheet to Rule Them All

That spreadsheet is exactly what I was looking for. There goes the next hour of my day :o)

Enjoy :). I’m going to write a post about it later. It’s an awesome tool. My favorite part is the smart highlight, where you can enter your min and max investments per month, and see how much money you can have after a certain number of years. It puts things in perspective.

Interesting way to think of it!

You could share the code via Github or something, no?

Was thinking of that, but then I’d need to make a ZDF GitHub account which would be silly. But here’s the code on pastebin

Thanks!

Not necessarily silly if you planned on more stuff in the future. 😃

Been considering making a blog github and pursuing making more calculators/tools to share. Currently just have one live on the site (rent vs buy, but for considering multifamily homes with a live-in landlord situation)

Hmm… I like that idea! We could write code to do some cool financial calculations, and then provide edits, expand functionality, etc. hmm…

Oops typo in the previous comment — you can delete that one. Fixed version below.

Thinking about this a little more…you actually can do a closed-form solution for monthly payment!

The complex sum of [(1+r) + (1+r)^2 + (1+r)^3 + … + (1+r)^t] can be simplified using Gauss’ trick.

Let x = 1 + r

and Sn = x + x^2 + … + x^t

so x * Sn = x^2 + … + x^t + x^(t+1)

so x*Sn – Sn = x^(t+1) – x (all other terms cancel out)

and Sn * (x – 1) = x^(t+1) – x

so, the original sum is just Sn = (x^(t+1) – x) / (x – 1)

after which you can just substitute x = 1 + r to get the original variables in place, and solving for d is pretty straight forward from this point.

I am not an intense math person, but this looks great, thanks!

David. Boom. Nice and simple excel chart. I love it and you took me down memory lane with the “guess and check” method. But in all seriousness, I love how you presented this article and showed people how easy it can be to be a millionaire if you start early. Sure it may be hard for someone to think about your portfolio 40 years from now. But if you can get started early enough, and that is usually the goal with our blogs as we work to encourage people to start off as soon as possible, it can be easy to achieve and establish the habit of saving/investing. Obviously the longer you wait the more difficult it becomes. In all seriousness, based on your table, I am not investing enough each month to get to $1m.

Thanks for taking the time to put this together!

Bert

Thanks! I’m not investing enough either, but I’m definitely getting close! Hopefully I’ll be there soon, but never any guarantees 🙂