Investing for retirement is important at any age, but the same strategy should not be used for every stage of your life.

Those who are younger can tolerate more risk or can contribute smaller amounts, if that's all they can afford. Those who are older should take advantage of higher salaries to make the most of their peak years.

Read on to see our investment recommendations for different age groups. (See also: Retirement's Changing Tide: How to Help Clients.)

Beginning Retirement Planning: Your 20s

Even though you may have recently graduated from college and are likely still paying off student loans, use this time to start investing. Whether it’s in a company 401(k) or in an IRA you set up yourself, invest what you can as a 20-something, even if you can’t contribute the 10% recommended amount.

You have the biggest advantage over everyone in investing right now: time. Because of compound interest, what you invest during this decade has the greatest possible growth. Since you have more time to absorb changes in the market, you should also invest aggressively in stocks and avoid slow-growing assets like bonds.

Career-Focused: Your 30s

If you put off investing in your 20s due to paying off student loans or the fits and starts of establishing your career, your 30s are when you need to start putting money away. You’re still young enough to reap the rewards of compound interest, but old enough to be investing 10% to 15% of your income.

Even if you’re now paying for a mortgage or starting a family, contributing to your retirement should be a top priority. You still have 30 to 40 active working years left, so this is when you need to maximize that contribution. Make sure to put in enough to get the company match in your 401(k) and consider maxing it out if you can. (See also: Retirement Planning for 30-Somethings.)

You can still afford some risk, but it may be time to start adding bonds to the mix to have some safety. 

Retirement-Minded: Your 40s

If you’ve procrastinated saving for retirement until your 40s, or if you were in a low-paying career and switched to something better, now is the time to buckle down and get serious. You’re at the midpoint of your career, and you're probably reaching your peak earning potential.

Even if you’re saving for your kids’ college funds or continuing to pay your mortgage, retirement savings should be at the forefront of every financial decision. You have enough time to play catch up if you’re careful, but not enough time to mess around. Meet with a financial advisor if you’re not sure about which funds to choose. You’ll need to save in aggressive assets like stocks so your funds to beat inflation.

However, "aggressive" doesn't mean careless. Stick with investments that have a track record of producing returns and avoid deals that are "too good to be true."

Almost Retirement: Your 50s and 60s

Since you’re getting closer to retirement age, now is not the time to lose focus. If you spent your younger years putting money in the latest hot stocks, you need to be more conservative the closer you get to actually needing your retirement savings. (See also: Why Maxing Out Your 401(k) Is Profitable.)

Switching your investments to more stable, low-earning funds like bonds and money markets can be a good choice if you don’t want to risk having all your money on the table. Now is also the time to take note of what you have and when might be a good time for you to actually retire. Getting professional advice can be a good step to feeling secure in choosing the right time to walk away. (See also: Tips for Gen X Savers at Age 50.)

Another approach is to play catch-up by socking more money away. The IRS allows people approaching retirement to put more of their income into investment accounts. Workers over 50 with a 401(k) can add $6,000 over the $18,500 limit, and IRA investors over 50 can put away $6,500 instead of the usual $5,500 limit.

The Bottom Line

A Chinese proverb says: “The best time to plant a tree was 20 years ago. The second best time is now.”

That attitude is at the heart of investing. No matter how old you are, the best time to start investing was 20 years ago, and the second-best time is now. It’s never too late to do something.

Just make sure the decisions you make are the right ones for your age—your investment approach should age with you. It's also a good idea to meet with a qualified professional who can tell you where you stand and where you need to go. (See also: Top Retirement Hack? Start With a Lifestyle Change.)