Before lenders decide to give you a loan, they need to know that you're willing and able to repay that mortgage. To understand your ability to repay, they assess your income and debt ratio. In order to assess your willingness to repay the mortgage loan, they consult your credit score.
The most widely used credit scores are called FICO scores, which Fair Isaac & Company, a financial analytics agency, developed. Your FICO score ranges from 350 (high risk) to 850 (low risk). We've written more about FICO here.
Your credit score comes from your repayment history. They don't consider income or personal characteristics. Fair Isaac invented FICO specifically to exclude demographic factors like these. Credit scoring was envisioned as a way to consider only what was relevant to a borrower's likelihood to pay back a loan.
Your current debt level, past late payments, length of your credit history, and other factors are considered. Your score is calculated from the good and the bad in your credit report. Late payments will lower your credit score, but establishing or reestablishing a good track record of making payments on time will raise your score.
To get a credit score, you must have an active credit account with at least six months of payment history. This payment history ensures that there is enough information in your report to build a score. Should you not meet the minimum criteria for getting a score, you may need to work on a credit history prior to applying for a mortgage loan.