Buying a home is exciting, but it usually comes with a lot of questions—the biggest of which is usually “How much can I afford to spend on a mortgage?” In order to figure it out, you need to understand all of the expenses involved in owning a home.

Scroll down for video

Mortgage companies look at your gross monthly income, or GMI, to figure out how much you can afford. Conventional lenders advise that you spend no more than 28 percent of your GMI on your mortgage, taxes and insurance, and up to 36 percent in total debt.

That means that if you don’t have additional debt—such as school loans, car loans or credit card debt—you can spend up to 36 percent of your GMI on housing.

How big of a mortgage payment can I afford?

Let’s say you make $60,000 a year, or $5,000 per month gross. If you have additional debt, you can spend 28 percent of that $5,000—or $1,400 per month—on your mortgage, taxes and insurance.

If you don’t have additional debt, you’ll be able to spend 36 percent of your GMI, or $1,800 per month.

What about property taxes and insurance?

Figuring out how much you’ll owe in taxes is fairly easy. Depending on where you live, properties are taxed at a rate of 2 to 3 percent per year, or $2,000 to $3,000 on a $100,000 property.

Your insurance costs can vary greatly and are dependent on factors like location, home value and the type of insurance you purchase. The Federal Reserve Board estimates annual homeowners insurance premiums average between $300 and $1,000 (or, roughly $3.50 per $1,000 of the home’s purchase price).

If you need to purchase other types of insurance, such as flood or earthquake, you will probably pay additional premiums.

Keep in mind that if you put less than 20 percent down on your home purchase, you may be required to pay private mortgage insurance (PMI). The Federal Reserve Board estimates that PMI costs between $50 and $100 per month.

You can cancel your PMI once you reach 20 percent equity in your home.

Don’t forget maintenance costs.

If you live anywhere that has a homeowner’s association, your maintenance costs will be evident up front in the form of HOA dues or assessments. Lenders will factor in those costs when they assess how much you can afford to spend each month.

If you own a house instead of a condo or co-op, don’t forget to factor in additional maintenance expenses such as snow removal, tuck-pointing, gutter cleaning and other repairs. Unlike HOA fees, this is not a set cost, so the lender won’t factor in these expenses when qualifying you for a mortgage—but you’re still responsible for them.

Depending on where you live, you can easily spend $5,000 to $8,000 a year maintaining your property. That estimate doesn’t include extra costs, such as replacing appliances when they fail.

Think carefully about how much you can realistically afford, and remember that not all of it can be used to pay your mortgage. If you’ve decided you can spend $2,000 a month on a house, remember that the total amount must cover taxes, insurance and maintenance costs in addition to your mortgage payments.

You’ll also need to save a set amount each month—ideally, $100 to $200—toward unforeseen maintenance expenses that will almost certainly arise at some point down the road.