The investing information provided on this page is for educational purposes only. NerdWallet does not offer advisory or brokerage services, nor does it recommend or advise investors to buy or sell particular stocks, securities or other investments.

Millennials have been coined the “job-hopping generation,” and I’ve contributed to that stereotype. I started my career at 22 and have job-hopped almost every year since. For many of those years, I was young and restless, and there was another part of me looking for more fulfilling work and pay that reflected what I was worth.

In some ways, changing jobs set back my retirement savings. There are things I wish I’d learned earlier, like how to start retirement planning, the importance of developing high-demand skills, and the art of negotiating benefits. But it has also helped me improve my earnings. Once “lifestyle creep” — when your income increases and your spending habits do, too — stopped getting the best of me, earning more meant I could save more for retirement.

Here are a few scenarios where job-hopping can help your retirement savings, and where it may hurt.

Yes — if you’re improving earning potential

In one of my earliest writing jobs, I earned about $25,000 per year. As much as I enjoyed writing, I knew I was underpaid and overworked. My next move was looking for ways to earn more as a writer, and that’s when I realized I had to develop new skills, such as optimizing my writing so it would be visible in search engines like Google. Within a year, I started a new job that paid me $45,000 and offered more benefits. Since I was no longer living paycheck to paycheck and finally had a 401(k) plan, I could start saving for retirement.

Changing jobs for a significant increase in income could potentially help your retirement savings, but it requires you to actually put some of that increased income toward your retirement savings.

What is the benchmark for a “significant” increase in income? Aim for a 10% increase, says Mary Beth Storjohann, a certified financial planner and co-CEO of Abacus Wealth Partners in Santa Monica, California. If a new job offer comes in below that, Storjohann recommends running the numbers to see how much your take-home pay actually improves when you factor in taxes and other living expenses.

No — if company matches and equity haven’t fully vested

If you’re going to job-hop, you don’t want to leave free money on the table, as that could hurt your retirement savings, says Jerel Butler, a CFP and CEO of Millennial Financial Solutions based in New Orleans. Before throwing up the deuces sign, consider getting your full retirement plan match, restricted stock units or other company equity if your employer offers it.

“Typically, companies have a dedicated vesting schedule for the employees as an incentive to continue working at that particular company,” Butler says. “Sometimes, with companies that match contributions for 401(k) plans, they may ask you to contribute up to two, three, even four years before the company match is fully vested.”

Butler also suggests hanging around long enough to get any potential bonuses, which are often distributed during the first quarter of the year.

No — if benefits don’t improve retirement savings

The right benefits package could improve long-term retirement savings, so it’s something to consider when changing jobs. When I accepted the job I mentioned earlier, I didn’t think about this. Turns out health care premiums cost me around $500 a month, there were no flexible work arrangements, and the company offered no education stipends. These things indirectly affected my retirement savings, because I had less money to save and little growth potential.

Storjohann says benefits to consider that could improve your retirement savings include your work location, access to retirement accounts, employer match amounts, health insurance, education stipends, stock options and annual raises.

Yes — if you do a 401(k) rollover

A few months after leaving the first job I had that offered a 401(k) plan, I got a check for around $300 in the mail. I remember thinking, “Wow! Free money right in time for the weekend.” Shortly after spending the “free money,” I realized it was the balance in my 401(k) account. I was supposed to roll it over into another retirement account within 60 days, but instead I squandered it on weekend festivities.

Cashing out 401(k) accounts or forgetting they exist altogether is a common mistake people make when changing jobs, and it can hurt your retirement pot, says Storjohann. Cashing it out or taking an unqualified early withdrawal could cost you a 10% penalty and income taxes on the amount withdrawn.

“You think, ‘Oh, the balance isn’t that big, I’ll just cash it out,’ so instead of having that money earmarked for retirement, it is typically then spent and then you’re paying penalties on top of that,” Storjohann says.

This was certainly the case for me and it has potentially set my retirement savings back a few thousand dollars. Let’s say I had rolled that $300 into an IRA and earned a 7% annual return — after 30 years, I would have over $2,200.

If I had a time machine, I still would have changed jobs, but I definitely would have done a 401(k) rollover to maximize my existing retirement savings.

This article was written by NerdWallet and was originally published by The Associated Press.