How much should you contribute to your 401(k)?

When you open a 401(k) you need to decide how much to save. While there isn't a one-size-fits-all solution, there are a few general rules of thumb to follow when figuring out how much money to stash away in your account. Here are some ways to determine the amount to save for retirement:

[See: How to Max Out Your 401(k) in 2018.]

1. Take advantage of your employer's match. If you work for a company that offers any kind of 401(k) match, contribute enough to take full advantage of it. Say your company offers a dollar-for-dollar match on up to 3 percent of your income. You should contribute at least 3 percent, which will result in a total 6 percent contribution to your 401(k) plan after including the match. You should always deduct enough from each paycheck to get your employer's full match. If not, you're passing up free money.

2. Open a Roth IRA. If you're eligible for one, aim to max out a Roth IRA once you've saved enough to get your employer's 401(k) match. Make the maximum contribution to a Roth account, which is $5,500 in 2018, and then go back to contributing what you can afford to your 401(k).

Doing some of your saving in a Roth IRA adds tax diversification to your retirement savings. While a traditional 401(k) is funded with pre-tax dollars, Roth IRA contributions are made with after-tax dollars that won't be taxed when you withdraw the money during retirement. In contrast, 401(k) withdrawals are taxed in retirement as regular income. Making contributions to a Roth account can help you reduce your tax bill in retirement.

[See: How to Save $1 Million by Retirement.]

3. Save at least 10 percent. A good way to begin preparing for retirement is to save at least 10 percent of your pre-tax income, whether it's in a 401(k) or somewhere else. Of course, the ideal number depends on your age, and those who start saving late will need to save a higher proportion of their salary. For example, if you're in your 20s or 30s, 10 percent might be enough for you to save and retire comfortably, since it has plenty of time to grow. It's best to save at a higher rate, such as 20 percent, if you're beginning to save in your 40s or older. The maximum you can contribute to a 401(k) in 2018 is $18,500, plus an additional $6,000 if you're age 50 or older.

4. Know when and how you'll retire. To get a better idea of just how much you need to be saving, calculate future retirement expenses to the best of your ability. Take into account where you want to retire, how much income you think you'll need and when you plan to take advantage of retirement benefits, such as Social Security. This can be time consuming and difficult to figure out, but it's important to have a ballpark retirement goal to help you figure out how much to save.

[See: 9 Easy Ways to Save $500 More Per Year for Retirement.]

5. Follow age benchmarks. Fidelity, a large investment firm and 401(k) provider, has a few benchmark recommendations about how much to save, such as accumulating the amount of your annual salary by age 30. Fidelity says most people should aim to save three times their salary by age 40 and six times their pay by age 50. This savings model is based on saving 15 percent of your income every year, starting when you're 25.

6. Don't forget about other savings. Saving for retirement is important, but there are a few other items you should take care of before you max out your 401(k). Once you take full advantage of any employer match, pay off high interest debts and build an emergency fund before you start putting more money into a retirement fund.

Aim to build an emergency fund with at least six months of living expenses, just in case you have a sudden major expense. If you do all of your saving in a 401(k) without building a safety net, you might need to take out a 401(k) loan if you have an emergency, which could trigger fees and cause you to miss out on investment gains.

While it's difficult to determine exactly how much to put in your 401(k), these six steps will help you tailor a retirement savings plan that will cover your retirement expenses.

Jacquelyn Pica is a junior writer at The Penny Hoarder.

Copyright 2017 U.S. News & World Report