What dollar-cost averaging does
Dollar-cost averaging means investing a fixed dollar amount on a fixed schedule regardless of price. When prices are high your money buys fewer shares; when prices fall it buys more. The result is an average cost per share that is lower than the average price over the period, and, more importantly for most people, a rule that keeps you investing when the headlines are ugly. If you contribute to a 401(k) from every paycheck, you are already doing it.
The math behind the projection is the future value of an annuity. With contributions at the start of each month, FV = C x [((1 + r)^n - 1) / r] x (1 + r), where C is the monthly contribution, r is the annual return divided by 12 and n is the number of months. Any starting balance grows separately as FV = P x (1 + r)^n and is added on.
A worked example
Invest $500 a month for 20 years at an assumed 7% annual return, compounded monthly. Here r = 0.07 / 12 = 0.0058333 and n = 240, so (1 + r)^n = 4.0387. The annuity factor is (4.0387 - 1) / 0.0058333 = 520.93, times $500 gives $260,465, and multiplying by (1 + r) for start-of-month timing gives about $261,983.
You contributed $120,000 of your own money, so roughly $142,000 of the ending balance is growth - more than half. Push the same plan to 30 years and the projection rises to about $613,500 on $180,000 of contributions. The extra decade does most of the work, which is the practical argument for starting early rather than saving more later.
Using this with a 401(k) or IRA
For a 401(k), enter your own payroll deferral plus any employer match as the monthly contribution - a 50% match on the first 6% of pay is an immediate 50% return and belongs in the number. The 2025 elective deferral limit is $23,500 with a $7,500 catch-up at age 50 or older; IRA contributions are capped at $7,000 with a $1,000 catch-up. Check current IRS figures, because they are indexed each year.
Two adjustments make the projection more honest. Subtract fund expenses from your return assumption: a 0.05% index fund barely dents it, a 1% advisory fee plus a 0.6% fund turns 7% into 5.4% and cuts the 20-year result by roughly a fifth. And remember these are nominal dollars. At 3% inflation, $261,983 in 20 years buys what about $145,000 buys today, so run the inflation calculator alongside this one.
Finally, the return box is an assumption, not a promise. US large-cap stocks have returned roughly 10% a year nominal over the very long run, with drops of 30% or more along the way. Many planners model 6% to 7% for a stock-heavy portfolio and less for a mixed one.