5 habits to start in your 20s if you want to retire by 40

Paul Bradbury | Getty Images

If you want to retire early, you're going to have to start saving early. That's clear. The tricky part is actually establishing the habits that will help you reach your goal.

Luckily, even some everyday people have reached financial independence at a young age and shared their top tips to assist you as you try to do the same.

Here are five tested, helpful habits to establish in your 20s if you want to settle down before 40.

Track your expenses

Whether you track your purchases in a spreadsheet or use an app like Mint or You Need a Budget to do it for you, knowing how much you bring in and you how much you shell out is crucial.

Many early retirees started their journey to financial independence by analyzing their spending habits and figuring out exactly how much they need to retire comfortably. "You have to know what you are spending before you can plan your retirement budget," says Justin McCurry, who retired with more than $1 million in his 30s.

Retire by 40 by giving up these habits
Retire by 40 by giving up these habits

Set clear and specific retirement goals

If you've set a target date, you're on the right track to retiring early. You'll also want to make a retirement budget, which will help you figure out exactly how big your portfolio needs to be to last through your golden years.

Many early retirees use the "four-percent rule" — the formula some say can help you figure out the amount you can withdraw from your retirement savings each year without running out — to help them determine their magic number.

Pay yourself first

Once you've established a plan, you can focus on execution, which all starts with paying yourself first — meaning, you consistently send a chunk of your income to a tax-advantaged retirement account, such as a 401(k), Roth IRA or traditional IRA. The earlier you want to retire, the greater the percentage should be.

Pro tip: Automate your system. If you have a certain percentage of your paycheck automatically sent straight to your savings, retirement or investment account, you'll never even see that money and won't be tempted to spend it.

24-year-old Silicon Valley engineer lives in his truck and saves 80% of his income
24-year-old Silicon Valley engineer lives in his truck and saves 80% of his income

Save half your income

Most early retirees have the discipline to keep a large chunk of their paycheck — often, more than half of it — thanks to a variety of strategies you can check out here.

If you're working towards setting aside 50 percent of your paycheck, you're well on your way to financial freedom.

Maximize your income

If you're thinking about ways to generate more income, in addition to saving a ton, you're on a good path.

As early retiree Chris Reining tells CNBC: "At a certain point, you need to figure out how you can make more money, because that's really limitless. You're never going to get to zero spending, but you can always make more money, so once you get to a balance of spending that you're comfortable with, focus on pulling on that other lever that you have, which is making more money."

Increasing your revenue streams could mean finding a part-time job, starting a side hustle or establishing passive income.

Like this story? Like CNBC Make It on Facebook.

Don't miss: 9 strategies to save a fortune, from real people who bank half their income

How this couple saved over $1 million in retirement savings to retire by 43
How this couple saved over $1 million in retirement savings to retire by 43