Lenders start with your income, take off tax, living costs and the repayments on any other debts, and see what's left. Then they work out the largest loan that surplus could repay. The key detail: they test the repayment at a higher rate than you'll actually pay, so the loan still works if rates rise.
Credit cards count even if you never use them. Lenders assume you could spend the full limit, so they set aside a monthly repayment for it. Lowering or closing unused cards before you apply can lift what you can borrow.
Most home lenders also check your total debt against your income. That's the debt-to-income ratio (DTI). The final number is whichever limit is lower.
Try it yourself: the borrowing power calculator uses the same approach.