How much house can you afford? Consider the 28/36 rule.

The best time to decide how much you can safely spend on a new home is before you begin looking, to avoid falling in love with a house that would stretch your finances too thin. Fortunately, there is a tried and true method for determining what’s “too much”.

It’s called the 28/36 rule and it’s been a standard lenders tool for decades. But it’s also a homebuyer’s tool, enabling you to calculate what’s reasonable based on your income and other debts.

Here’s how it works. The number 28 refers to 28% of your monthly gross income (so, pre-tax) and represents the maximum monthly housing payment you should consider taking on. So if you make $5,000 per month, the rule suggests you cap your housing costs at $1,400.

Note that housing includes not just your mortgage payment, but also your monthly share of property taxes and homeowner’s insurance, as well as private mortgage insurance and homeowner association fees, if those apply.

As for the 36, lenders are checking that your total debt obligations each month don’t exceed 36% of your monthly income. This includes not just your housing expenses, but all your debt, such as payments on auto loans, student loans or credit cards.

Using the same $5,000 monthly income example as above, this allows for a total debt obligation of $1,800. So if your existing debt is $400 or less, you’d still be within the boundaries to take on $1,400 in housing costs. But if your monthly debt is already $800, you’d have just $1,000 available for housing.

Since the 28/36 rule is a guideline rather than a federally mandated rule, lenders are sometimes willing to flex the ratios if you have excellent credit. But keep in mind that the rule can still be useful for keeping yourself in check.