While buying a home can be a sound investment, it can also become a financial burden. Here's how to think about your housing budget so that doesn't happen to you.

Someone who is house poor spends so much of their income on homeownership — such as monthly mortgage payments, property taxes, insurance and maintenance — that there's very little left in the budget for other important expenses.

Being house poor can limit your ability to build up retirement or other savings, pay off debt, travel or enjoy life.

In fact, 28% of recent home buyers said making their monthly mortgage payments will be among their biggest money stressors for the next two years, according to the NerdWallet 2021 Home Buyer Report.

Before shopping for a home, it's important to figure out how much house you can comfortably afford, which may be a different number from the maximum mortgage you can get approved for.

"Home affordability calculators are definitely a good starting point for helping to determine your housing budget," says Jake Northrup, a certified financial planner in Bristol, R.I. "However, they also require that you have a strong understanding of your cash flow today — what income is coming in, what expenses are going out and what amount you are saving."

One rule of thumb is that you shouldn't spend more than 28% of your gross monthly income on housing-related costs and 36% on total debts, including your mortgage, credit cards and other loans.

While the 28/36 rule is a good guideline, said Mark Avallone, a certified financial planner at Potomac Wealth Advisors in Maryland, the rule doesn't take into account the need to leave room in your budget for things such as furniture, as well as maintenance and repairs.

The cost of unexpected home repairs and ongoing maintenance can take first-time home buyers, in particular, by surprise. Even a house that was in very good condition on closing day will inevitably need some big-ticket fixes over the years.

NerdWallet's 2021 Home Buyer Report found that 41% of people who have purchased a home in the past 12 months said their biggest money worries in the coming two years will be affording home repairs and maintenance.

Saving 1% of the property's value is a good starting point for maintenance expenses per year, said Ibijoke Akinbowale, director of the Housing Counseling Network at the National Community Reinvestment Coalition.

But, she notes, you may need to scale up to 2% of the property's value based on the age and condition of your home.

Even if you plan properly for a home, it's possible to become house poor if a job loss or medical emergency leaves you unable to pay your bills.

To avoid spending too much of your income on homeownership:

• Make a larger down payment to lower your monthly mortgage bill, but don't make it so big that you deplete your savings.

• Put aside money every month specifically for housing expenses can provide you with a cushion for the unexpected.

• Buy a starter home, usually a smaller property that is typically more affordable for first-time home buyers.

• Rent out space to generate additional income.

E-mail Linda Bell at lbell@nerdwallet.com. Twitter: @lindanbell.