![[savings account, 401(k), Roth IRA]](http://www.csharphelper.com/howto_401k_graph.png)
Important Note: I am not a tax or investment professional. I don’t even pretend to understand this stuff. This is a very simple tool for playing with numbers (it doesn’t even compound continuously) and I don’t vouch for its correctness. It should in no way be taken for investment advice. What, are you crazy???
That being said…
The example Compare a savings account to a 401(k) in C# compares the balances you would have after investing in a traditional bank account versus a 401(k). This example graphs the results and adds a Roth IRA account.
As far as I can tell, these are the rules:
- In a traditional bank account, interest is taxed every year. Money you plan to put into the account is taxed first. This program takes taxes out of the annual contribution.
- In a 401(k) account, the annual contribution is taken from pre-tax money so it is not taxed. Interest is also not taxed. When you withdraw the money, it is all taxed at your current tax rate. (One advantage to this type of account is that you may be paying at a lower rate when you retire than you would pay when you make contributions.) There may also be a penalty for early withdrawal.
- In a Roth IRA, annual contributions are post-tax so this example withholds taxes from the contributions. Withdrawals are not taxed, although there may be a penalty for early withdrawal.
- These are not the only rules. For example, you may be allowed to make early withdrawals without penalty in case of hardship. The program doesn’t do anything about these extra rules.
This program marches through each of the years specified, calculating new balances each year, and displays the results. Download the example program to see the details.
Interestingly the 401(k) and Roth IRA produce the same final result if the tax rate you pay on the withdrawal is the same as the rate you paid while making contributions. If the rate is lower, the 401(k) does better.
If you understand this stuff better than I do and want to make corrections, please post a comment and I’ll update the program if possible.



