Leaving a job is never an easy decision, and it can be more complicated if you have a 401(k) at your current company. After all, you’ve spent a lot of time and money investing in that account, and leaving before you’re fully vested could send your retirement planning off track.

What is vesting?

Typically, there are two types of contributions that are made to a 401(k): those made by the employee—usually as an automatic deduction from his or her paycheck—and those made by the employer. For example, your company might match your personal contributions dollar for dollar up to 3 percent of your salary.

Vesting is, in the case of your retirement account, defined as acquiring ownership. For each year you remain employed, you vest, or acquire ownership in, a certain percentage of the current value of the contribution made by your employer.

The free money from your employer’s contribution can be a nice perk, but you may not see all of it. While whatever personal contributions you make to your retirement plan belong to you (you are 100 percent vested in those), the money that your company contributed may or may not be yours to keep if you leave.

What is a vesting schedule and how does it work?

The vesting schedule, which establishes when you will gain ownership of part or all of your employer’s contribution, can usually be found in the plan documents provided to you by your employer. If you do not have a copy of these documents, you can always request them from the human resources department.

While your particular schedule may vary, the two main vesting schedules for 401(k)s are:

Graded vesting: If you’re on a graded vesting schedule, after a certain period of service you will become vested in at least 20 percent of your accrued employer contributions.

After the initial period, which can vary depending on your employer, you will become vested in employer contributions for each year of your service until you’re fully vested.

Your plan may have a quicker vesting schedule, but you must be fully vested after year six. That means that if you leave in four years instead of six, you may lose out on the employer contributions above and beyond the amount in which you are vested. But if you wait until you’re fully vested, all of the funds in your retirement account would belong to you.

Cliff vesting: Unlike a graded vesting schedule, where you vest more each year after a certain period, a cliff vesting schedule means you have no vested interest in the accrued employer contributions until a certain specified date—usually after a certain number of years working full time for the company.

Once that milestone is reached, whenever it may be, you become 100 percent vested in your employer’s contributions. So if you left the company with only two years and 11 months of service, you would only be entitled to the value of your own contributions and not anything your company may have contributed. But once you hit the milestone and are 100 percent vested, you are entitled to all the funds in your retirement account.

Should I stay or should I go?

It’s the million dollar question: Does it make sense to leave your company before you are fully vested?

Before making this decision, review your plan documents to see if you will lose any money and, if so, how much. For example, if you fall under a graded vesting schedule and you have been working for your company for just under two years, it might make sense to stick it out for the full two years and leave with 40 percent of your employer’s contributions instead of 20 percent.

The same could be said if your plan has a cliff vesting schedule, where if you can hang in there and complete a certain number of years of service, you will be able to leave the company fully vested.

Whether you stay or leave is a personal choice, and there are no one-size-fits-all answers. If you are miserable at your job, you may want to leave even though you may be leaving some money on the table. After all, you can’t put a price tag on your quality of life.

Steve Repak is a CERTIFIED FINANCIAL PLANNER™ professional, CFP® Board Ambassador, and financial literacy speaker. He is also an Army veteran and the author of Dollars & Uncommon Sense: Basic Training For Your Money. Follow him on Twitter: @SteveRepak