Other generations borrowed to go to college, but the rising cost of school has saddled millennials with an unprecedented level of debt. According to the Federal Reserve, student loans totaled $240 billion in 2003; by the end of 2019, that number reached $1.51 trillion. In 2003, student loans were 3.3 percent of total household debt; in 2019, it was 10.7 percent.

While student loans will indeed be a barrier to getting a mortgage, they don’t have to prevent you from qualifying for a loan or from getting a good rate. Like much of what lenders evaluate in your application, student loans are just a piece of the puzzle.

Student loans factor into what is called your debt-to-income (DTI) ratio. Your DTI is your monthly debt (loan payments on things like your car, credit cards, and student loans) divided by your monthly gross income (your pre-tax income before any expenses are taken out, which you can usually find on your pay stub).

Lenders calculate this ratio twice—once without your mortgage (front-end) and once with it (back-end). Lenders generally won’t extend a mortgage to someone who has a front-end DTI of more than 28 percent or a back-end DTI of more than 36 percent. If you’re on the wrong side of those numbers, all is not lost; there are steps you can take to help.

Your best move: Pay your debt down

If your debt relative to your income is too high, there’s a straightforward way to alleviate that: Pay down the debt. Start with consumer credit card debt, of course. If you’re debt-free other than your student loans and you’ve been saving up for a down payment, it might make sense to put that toward your loans instead of your future-home nest egg.

...or lower your price range.

Lowering your purchase price (and therefore loan size) will improve your DTI and may make the difference between qualifying for a mortgage and not.

A possible strategy: Refinance your debt

Refinancing your loans or consolidating them with other debt, such as auto loans or credit card debt, could help get your monthly payment down and thus improve your DTI. There are caveats to this, however.

If you have federal student loans, you can only refinance them with a private lender, and if you move your loans to a private lender, you forfeit options that can help you over the long haul. For example, you would no longer be able to claim federal loan forgiveness if you work in public service or for a nonprofit. You also likely wouldn’t be able to find a private lender who would put you on an income-driven repayment (IDR) plan (see more on that below). Federal loans can sometimes be temporarily deferred or put on an interest-free payment plan if you run into financial trouble. (Note: Deferring your student loans wouldn’t remove them from your DTI calculation).

If your loans are already with a private lender, it’s worth doing some shopping online to see if you can find a better rate. Because if you’re on the edge of qualifying for a mortgage, it could be determining whether or no you are approved.

Another option for federal loans: Look into income-driven repayment (IDR) plans

If your student loan payment is unmanageable and refinancing won’t get your DTI down, you can switch your loans to an IDR plan, but only if your loans are federal, not private.

There are multiple IDR plans, but generally the IDR plan would set your monthly payment at 10 percent of your monthly income. Depending on your income, this could have a huge impact on your DTI and thus get it in the right range for qualifying for a mortgage.

There are long-term consequences to this, however. The less you’re paying on your student loans, the longer it will take to pay them off and the more you’ll pay in borrowing costs over the lifetime of the loan. So while this may help you in the short term, it’s worth sitting down and doing the math on how it will affect you in the long run.

Find a down payment assistance program

If coming up with a sufficient down payment is hard for you, there are a number of down payment assistance programs for low- to moderate-income borrowers that can help. Many private banks have down payment assistance programs, and there are plenty of government programs administered by the Department of Housing and Urban Development, in addition to state and local governments.

If you’re not a conventional loan candidate, go the FHA route

If your credit’s so-so and your DTI is high, a loan backed by the Federal Housing Authority (FHA) may be your best (and possibly only) option. FHA loans for borrowers with credit scores of at least 580 can make a down payment of just 3.5 percent; for scores between 500 and 579, you’ll need a 10 percent down payment, and a DTI of up to 46 percent is allowed. You’re probably thinking this sounds amazing, but know that you will pay a premium for one of these loans: Interest rates are higher than conventional loans and mortgage insurance premiums are required.

Consider a non-QM lender

After the financial crisis in 2008, Congress passed the Dodd-Frank legislation, which put strict standards on the type of mortgages Freddie and Fannie can buy. Those mortgages, referred to as qualifying mortgages (QMs), became the standard for all lenders that want to sell to Fannie and Freddie.

But there are lenders that underwrite mortgages that don’t qualify for resell to Freddie and Fannie. These tend to be either large mortgages on luxury housing or on the other side of the spectrum subprime mortgages. If you’re having trouble qualifying for a mortgage, chances are it’s because your profile doesn’t match Freddie and Fannie standards, so a possible next step would be to simply go to a lender willing to extend a non-QM mortgage. However, these mortgages tend to come with higher interest rates and other costs, so keep that in mind before taking the plunge.