A conservative approach is the 28% rule, which suggests you shouldn't spend more than 28% of your gross monthly income on your monthly mortgage payment.
Be aware that lenders look at far more than the percentage of monthly income put towards a mortgage. Outside of credit score, lenders typically look at your debt-to-income ratio, which compares your monthly debts, including the prospective mortgage payment, to your expenses. With lenders looking at income and expenses, our mortgage calculator provides a great option when determining what you can potentially afford.