CNET’s mortgage calculator can help you figure out how you can affording when searching for a new house. Our calculator works by collecting some basic financial information, layering in some regional home sales data and calculating an estimated monthly mortgage payment. (Note that the information collected is used only to calculate your monthly mortgage payment — and not for marketing or ad-targeting purposes.)

This home mortgage calculator can only provide you with an estimate — your actual monthly mortgage payment (and other related costs) will depend on your specific financial situation, the property, your state of residence and your lender’s terms and conditions.

This calculator uses your ZIP code to estimate a property tax rate, and your credit score to estimate a mortgage interest rate. It uses your monthly income and your current monthly debt payments to calculate the monthly payments you can afford to stay under a target debt-to-income ratio. Finally, the calculator subtracts your other estimated monthly expenses, such as property taxes and homeowners insurance, to determine your monthly housing budget — and the total home price you can afford.

The formula used is: Monthly payment = (income x DTI) – debts – tax – insurance.

If you want to figure out how much your monthly payment will be instead, check our our mortgage calculator.

You can quickly gauge how much you can safely spend on a mortgage and other debts by using the 28/36 rule. Not only can this rule give you insight into your overall financial health, but many lenders use it to determine whether you’re a good loan candidate.

So what is the 28/36 rule? This simple rule of thumb says that you should spend a maximum of 28% of your gross monthly income — that’s your salary before any taxes or deductions come out — on housing-related expenses — such as your mortgage payment, principal, interest, taxes, private mortgage insurance (PMI) and homeowners dues.

This rule also says that you should keep all of your household debt under 36% of your gross monthly income. That includes your mortgage, credit card payments, car loans and student loans.

For example, if you make $5,000 per month (before taxes), using the 28% rule, you could safely spend up to $1,400 on your housing expenses. You should also aim to keep your total monthly household debt under $1,800 (or 36% of your pay).

Of course, these amounts are the upper limits of what you should plan on spending — if possible keep these costs under the 28/36 thresholds.

Your debt-to-income ratio (DTI) shows lenders how much you make each month compared to how much you spend on debt. This figure helps lenders assess your financial health and when evaluating your loan application.

To calculate your DTI, you’ll divide your monthly debt payments — loans, credit cards, alimony and child support — by your gross monthly income to get your DTI percentage. If you’re applying with your spouse, include both of your incomes and debts in this calculation.

To qualify for a mortgage, try to keep your DTI as low as possible. Most lenders prefer borrowers with a DTI of 36% or less.

For example, let’s say that you earn $5,000 per month and these are your monthly expenses:

From there, you’d divide your monthly expenses ($2,000) by your monthly income ($5,000), giving you a 40% DTI. While this might qualify you for a mortgage with some lenders, paying down some of your deb could help lower your DTI, making your mortgage application more attractive to lenders. A lower DTI could also help you qualify for a better mortgage rate, saving you thousands in interest.

This affordability calculator can help you determine how much of a home you can afford, but that doesn’t mean you should look for homes for the maximum amount in your price range. Buying a home comes along with many upfront costs that you’ll want to consider when shopping for a home.

With an FHA loan, you’ll need to put at least 3.5% of the home price down at closing if your credit score is 580 or higher. If your score is lower than 580, you’ll need to put at least 10% down.

When putting down less than 20% with an FHA loan, you’ll also be required to purchase a mortgage insurance premium (MIP). This has two costs — an upfront fee and recurring monthly charge. The upfront fee is currently 1.75% of your home loan amount. Your annual percentage rate will vary depending on your home price, loan-to-value ratio (mortgage balance divided by your appraised home value) and your loan terms. Currently rates range from 0.45% to 1.05% and will be divided evenly into monthly payments you’ll pay along with your home loan.

Let’s say you use the calculator to determine you can afford a home up to $275,000. Using this price, if your credit score is 580 or higher, you’ll need $9,625 for your down payment with an FHA loan. If your credit score is below 580, you’ll need to put $27,500 down at closing.

If your credit score is a 600, you’ll need to put $9,625 down and take out the remaining $265,375 as a loan. In this scenario, your upfront MIP payment would be approximately $4,644 and if your annual MIP rate would be 0.85%. This means, your first year’s MIP would be $2,255.69, divided into 12 monthly payments of $187.97.

Assuming your closing costs are 3% of your home loan, you’ll need another $5,307.50 at closing. All in, you’ll need $19,576.50 at closing and not just the $9k down payment.

You can learn more about FHA loans here.

One of the main benefits of a USDA loan is that it doesn’t require a down payment, making it easier for manyto become a homeowner. However, USDA loans have strict criteria you’ll need to meet to qualify — including living in a USDA-designated area and not exceeding the income threshold for that area. You’ll also need to have a DTI under 41% and a monthly mortgage payment that doesn’t exceed 29% of your monthly income.

Let’s assume that you’ve used the mortgage calculator and found that you can afford a $275,000 home. Although you won’t need a down payment, you will need to take out mortgage insurance. This equates to an upfront fee of 1% of your loan amount (due at closing), as well as an annual payment of 0.35% of your loan amount (paid monthly with your mortgage).

In this example, your upfront fee would be $2,750, and your annual payment would be $962.50, split into monthly payments of $80.21.

Finally, since USDA loan closing costs typically run between 3-6% of the purchase price, let’s say yours is 4.5% (or $12,375). Altogether, that’s an upfront cost of $15,1258 — with no down payment.

You can learn more about USDA loans here.

Available to current or former US military members, VA loans are backed by the US Department of Veterans Affairs. Like USDA loans, VA loans are especially attractive to low-income home buyers since they don’t require a down payment. To qualify, you or your spouse must be a veteran or active duty service member, and your property needs to meet VA loan requirements. For example, it can’t be a fixer-upper or a secondary/vacation home.

Let’s say that the mortgage calculator determined that you can spend as much as $275,000 on a home. Since you’re taking out a VA loan, you won’t need to put anything down or pay for mortgage insurance.

However, you will need to pay a one-time VA funding fee at closing. This fee can be rolled into the loan amount and paid monthly, but we’ll include it as an upfront cost in this example. If you put 0% down, the fee is 2.3% for first-time VA loans and 3.6% for subsequent loans. The fee decreases if you put more money down, but let’s assume that it’s your first VA loan and you’re not making a down payment in this scenario. In that case, your funding fee would equal $6,325.

With a 4% closing cost, you’ll need to pay another $11,000 upfront. That comes out to a total of $17,325.

You can learn more about VA loans here.

Along with your principal, interest, taxes and insurance (aka PITI), there are several other costs of homeownership to consider in your budget.