When you buy a home, you’re in it for the long haul. You’ll have a mortgage payment for 15, 20 or 30 years, so it’s smart to shop around to find the best mortgage lenders out there.

How to look for a lender Mortgage lenders vary by the types of home loans they offer and the rates and fees they charge.

Before shopping for lenders, get your finances in order and learn about the different types of mortgages. Then compare lenders that offer the products and services you need.

Here are five tips to help you find the best mortgage lender. (See expanded explanations of our tips following the list of lenders.)

  1. Get your finances in shape. A good credit score and a low debt-to-income ratio will help you qualify for the best mortgage rates.

  2. Learn what kind of mortgage is right for you. A variety of mortgages are available. Understand the options, and look for lenders that offer what you need.

  3. Compare rates from multiple mortgage lenders. You can search for the best mortgage rates online.

  4. Get preapproved for a mortgage. Show sellers and real estate agents that you're a serious buyer by getting preapproved.

  5. Compare loan estimates from at least three lenders. The loan estimate spells out the loan terms, and it estimates the monthly payment, fees and closing costs.

NerdWallet has researched some of the best mortgage lenders to help narrow your choices.