Prospective home buyers are frequently advised to improve their credit scores before applying for a mortgage. Guidelines established by Fannie Mae and Freddie Mac incrementally increase interest rates for borrowers with credit scores below 760. How much more you pay with a lower credit score depends on the size of your mortgage as well as your score.

A recent analysis by Zillow found that home buyers with lower credit scores pay thousands of dollars more for the same property compared with buyers with high credit scores. Nationally, a borrower with excellent credit (a score of 760 or higher), could get a mortgage with a 4.5 percent annual percentage rate (APR) while a similar borrower with fair credit (a score of 640 to 680) could get a rate of 5.1 percent APR. Those different mortgage rates for a home with the median value in March nationally of $213,100 mean that the borrower with fair credit would spend $21,000 more over a 30-year loan than the borrower with excellent credit.

In a high-cost market such as San Jose, where the median home value in March was $1.3 million, a borrower with a lower credit score could pay $129,000 more than a borrower with excellent credit. In Pittsburgh, which had the lowest median home value among the metro areas Zillow analyzed in this study, a buyer with a fair credit score would pay about $9,000 more than a borrower with excellent credit on a median home priced at $137,900.

Multiple factors go into determining your interest rate, including your credit score, your loan-to-value (the amount you borrow compared to the sales price), your loan term, your down payment, your home’s location, your loan type and the type of property you’re buying.