Many people are under the impression that once you reach a certain age, you won’t be able to qualify for a mortgage. Although there is some logic tied to that myth, it doesn’t make it true.

In fact, as long as you’re a legal adult (over the age of 18), it’s illegal for a mortgage lender to decline you based on your age—regardless of being 21, 60, or 99-years-old, you can’t be denied a mortgage because of your age.

But this isn’t to say that mortgage lenders are obligated to offer you a loan. Even if you’re in the prime of your life, you’ll have to prove to your lender that you can afford your mortgage and that the odds of you going into foreclosure are slim.

Here are the factors that lenders do look at:

Debt to Income Ratios

Most lenders expect that your total monthly debts will equal no more than 36 percent of your gross income. This includes credit card payments, student loans, and of course, your estimated mortgage payments.

For this reason, it’s most beneficial to pay off the rest of your debts before you apply for a mortgage. It will greatly increase your chances of securing the mortgage you need.

Income

Mortgage lenders also want your mortgage to take less than 28 percent of your monthly income. In other words, the more money you’re bringing in per month—the more likely you are to get approved for a mortgage loan.

This is where age can make a difference. Not necessarily in terms of the chances of you getting a loan, but rather, when it comes to what income you’re including.

For most people between the ages of 20-50, the majority of their monthly income will come from their employee salary. On the flipside, many people retire in their 50s and 60s, after which their income will mainly be comprised of pension payments, high interest savings incomes, investment incomes, and other sources.

Credit Rate

No matter how old you are, the most important part of your mortgage payment is going to be your credit score. As is the case with any loan, the higher your credit score, the more credit you’ll be able to secure. Most mortgage lenders consider anything above around 740 to be a good credit score.

If you’re currently falling below that, try to increase your score as much as possible before applying for a loan. You can do this buy using credit, and making regular large payments to bring down your debt at a favorable rate.