A generation ago, it was common for people to stay at one company for their entire career and walk away with a pension that would cover retirement costs for the rest of their lives. Outside of government jobs, pensions have mostly become a thing of the past. Instead of pensions, the most popular retirement plan today is the 401(k).

401(k) plans are the main way millions of people save and invest for retirement. If you are about to start a job with a 401(k), want to make sure your 401(k) is set up right, or just want to learn a little more about how 401(k)s work, continue on with this guide to 401(k) plans.

What is a 401(k) Plan and how does it work?

A 401(k) plan is a type of employer-sponsored retirement account. If your company offers a 401(k) plan, you can save and invest for retirement with pre-tax dollars. That means you don’t pay any taxes on income the year you earn it. Instead, you pay taxes on withdrawals in retirement, presumably at a lower tax rate than you pay during your working years.

Some 401(k)s also offer the option to make Roth 401(k) contributions. In this case, your contributions are made with after-tax income. That means you pay taxes on the income this year but don’t pay any taxes on withdrawals in the future, including capital gains. For younger savers and investors with decades to go before their retirement, Roth contributions may be better than traditional 401(k) contributions.

At many companies, the employer will match employee contributions to a certain limit. For example, they may match 100% of up to 3% of your salary or 50% of up to 8% of your salary. Every company’s plan works differently, so check with your manager or HR department for more information on your specific plan.

Once you contribute, you typically have a list of mutual funds or ETFs available for investing. Ideally, you have a long list of low-fee funds. In reality, some employers offer very limited options with high costs. Again, check your 401(k) plan documents to learn more about your investment options.

What happens if you withdraw from a 401(k) plan before you retire?

You can save a lot on taxes with a 401(k). But what happens if you want to cash in early?

Once you turn 59½ years old, you can withdraw from a tax-advantaged retirement account penalty-free. With a 401(k), that means you just pay regular income taxes on withdrawals.

Early withdrawals from a 401(k) plan are subject to both taxes and penalties. You’ll pay your regular income tax rate plus a 10% penalty. That’s a huge cost, so avoid early withdrawals if you can!

401(k) plans also offer loans, where you can withdraw money early and pay it back. However, if you don’t pay them back in full you’ll get stuck with the penalty and taxes. That makes 401(k) loans a last choice if you’re in a financial pinch.

What is the difference between a pension plan and 401(k)?

Pension plans and 401(k) plans are both retirement plans, but the funding and plan management are very different.

Pensions are called a “defined benefit” plan. That means employers are committing to pay a specific benefit in the future. How they save and pay for it is up to the employer. Workers just have to show up and do their job. Then, in retirement, they’ll get a steady paycheck from the pension plan.

401(k) plans are considered “defined contribution” plans. Instead of a specific payment in retirement, employers contribute to your 401(k) account right away. It’s up to you to manage it well and save enough to last for retirement.

401(k) plans are more popular with modern employers because they can avoid big future liabilities. Instead of a promise to pay more in the future, they can make an additional contribution every payday with no future commitments.

How much should I contribute to my 401(k)?

There is no one-size-fits-all answer for retirement savings. Everyone has different incomes, monthly budgets, and retirement goals. No one will make sure you make regular retirement contributions. It’s important to take charge of your retirement and make sure your 401(k) is working for your goals.

Many financial experts suggest saving at least 10% to 15% of your gross income (that’s income before taxes and deductions) for retirement. That’s how much most people need to save to keep the same standard of living during their golden years. If that sounds like a lot, you can always start small and work up to a bigger number in the future.

Also, remember that your employer matching counts toward that 10% to 15% goal. If your employer matches up to 3% of your pay, you can contribute 3% less and still reach 10% or more.

Whatever you do, always take full advantage of your employer match. If you don’t, it’s like leaving free money on the table. Take every dollar your employer offers. Retirement contributions are often a major part of your total compensation package.

What are the typical 401(k) plan costs and fees?

The biggest disadvantage of 401(k) plans is the cost. 401(k) plans are notorious for high fees. Unless you are lucky enough to have them covered by your employer, you’ll likely pay a percentage of your account balance every year to the brokerage or bank that holds the account.

In addition to the plan fee, you’ll also likely pay fees for each mutual fund or ETF. The best plans include a wide range of low-cost funds, but many have limited, high-cost options only.

If you don’t like what you have available, let your HR manager know. If enough employees ask for improvements, you might just find yourself with a better 401(k) plan.

Take advantage of this tax-advantaged retirement plan

Retirement may feel like a long way off, but it’s never too early to get started. In fact, thanks to the power of compounding, earlier contributions are worth the most during retirement. There’s no such thing as a contribution that’s too small. The biggest mistake people make with their 401(k) is not getting started early enough.

If you have a 401(k) plan at work, you should absolutely participate. It’s one of the smartest decisions you can make for your long-term financial needs.