Here's the formula early retirees use to know if they have enough money

cdwheatley | Getty Images

You don't have to make six figures to retire in your 30s or 40s. Plenty of regular people earning regular salaries have shown us how to do it.

But how do these early retirees know when to quit their jobs? How do they know they have enough to fund their expenses for the rest of their lives?

Many of them use a simple formula: the "four percent rule," which says that in most cases you can safely withdraw four percent a year from your retirement savings portfolio.

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

Flipping the four percent rule can help you figure out how big your portfolio needs to be, or what's called your "magic number." Simply divide your annual spending by 0.04 (or multiple it by 25) to get your target.

For example, financial blogger "The Money Wizard" — a Minneapolis-based millennial who goes by the pen name Sean and is on track to retire by age 37 — plans to live off of about $30,000 per year. Using the four percent rule, he estimates he'll need $750,000 ($30,000 / 0.04) in the bank to retire comfortably.

Madison-based Chris Reining also used the rule before retiring in his 30s. "It really came down to, once I have enough money where I can withdraw four percent, then I can walk away," he tells CNBC. "I typically spend somewhere between $30,000 and $40,000 a year, meaning I needed to get to $1 million."

He did that at age 35 and officially left his information technology job two years later.

Here's how this North Carolina couple could retire in their 30s

Your retirement budget, which may fluctuate year-to-year, doesn't have to be completely set in stone. For example, early retirees Justin and Kaisorn McCurry started with a retirement budget of $32,000 a year, but after revisiting their portfolio in 2016, they realized they could increase it.

They had $1.15 million in their investment portfolio at the start of the year, Justin explains on his blog "Root of Good": "Applying our magical four percent variable withdrawal rate to the $1,150,000 current value gives us an annual withdrawal of $46,000. Add to that an estimate of $20,000 in Root of Good, freelancing, and consulting income for 2016, and we could spend up to $66,000 in 2016."

On the flip side, they can "always trim back on spending in some areas if our investment portfolio performed really poorly or we had an unexpected expense in one category," Justin notes.

Justin McCurry with family on vacation in Mexico.
Source: Justin McCurry

While many early retirees use the four percent rule to determine how big their nest egg should be, it is slightly controversial. Some experts recommend using a lower withdrawal rate to be safe.

Regardless, it's a good way to get a general idea of how much you'll need to fund your golden years.

Plus, early retirees do have time on their side and can always return to the working world. As "The Money Wizard" notes, "Maybe I'm way off base. Maybe my estimations are far too optimistic, or far too conservative. I could be blindsided by unexpected expenses. … On the bright side, if I'm off by 10 years, I'll still retire a full decade or so earlier than the few Americans who are actually planning for retirement."

Don't miss: How one couple saved $1 million in 4 years to retire by age 43