Millennials are buying homes at lower rates than previous generations, but that might not be the worst thing for their investment portfolios.
That's according to self-made millionaire and personal finance guru Ramit Sethi, who says that buying a house isn't always the best investment you can make.
"What if you discovered that real estate isn't as good of an investment as everybody says?" Sethi asks in an interview with CNBC Make It. Sethi is the author of "I Will Teach You to be Rich " and the founder of GrowthLab.com, an advice site for entrepreneurs.
While many first-time home buyers go into the process assuming that they can turn a tidy profit on any real estate purchase, Sethi says it's not always so simple. In fact, there are a lot of obstacles and costs that can prevent your real estate purchase from being lucrative if you're not careful.
"Most people never factor in all the phantom costs, including taxes [and] maintenance," Sethi says. "They don't factor in inflation and how that erodes the value of money over time."
Another important possibility some home buyers overlook is whether they'd be better off investing in stocks instead of real estate. "In fact, data shows that the stock market typically trounces the performance of real estate as an investment," Sethi says.
The most important thing you can do before buying a house, Sethi says, is to "run the numbers."
What you need to do, he says, is take into account your own finances and the average cost of buying versus renting a home in your area. You want to answer this important question: does buying a house make sense for you, where you live, as opposed to renting and putting the money you'd save into the stock market? You need to ask yourself: What's the best investment for you?
Obviously, stock market performance versus real estate appreciation can depend on a wide range of factors, from buying a home in an up-and-coming neighborhood to investing right before an economic downturn or a boom market. Over time, though, stocks do generally perform better than real estate.
"If you run the numbers, like me, you might discover that for where you live it actually makes no financial sense to buy," Sethi tells CNBC Make It. "Are there other reasons to buy? Of course. Maybe you want to buy because you want to knock that wall down. Maybe you want to buy because you want your kids to go to a certain school. Fine, but run the numbers."
Sethi suggests going online to find one of the many "Buy vs. Rent " calculators offered by real estate and personal finance websites. Those sites take into account factors such as where you want to live and how much you can afford to pay (both for a down payment and monthly expenses) to give you an idea of whether it makes more sense for you to buy real estate or rent property.
"Then you want to go a little deeper," Sethi says. "You want to say, 'You know what, what can I get in the stock market now?' Generally we can assume that over the long term, if we invest in a low-cost diversified index fund, we get about 7 percent [annualized returns]. Can you beat that in your area, over time, with real estate appreciation?"
If you do your homework and it doesn't seem like the real estate you can afford in your area will generate better returns than the stock market over several years — and you don't mind renting long-term — then you might be better off not being a home-owner, Sethi says.
Most importantly, though, you must do the math before making such a big decision. "For the biggest purchase of your life, you should know all the math and how it plays out 20 years in the future."
Like this story? Subscribe to CNBC Make It on YouTube!