To determine 'affordability' you will first need to know your income along with the amount of any debt outstanding and the monthly payments. Assuming it is your principal residence you are purchasing, calculate a percentage of your income for use toward a mortgage payment, property taxes and insurance. If applicable, the estimated monthly condominium maintenance fees or association fees will also be included in this calculation.
Second, calculate 50% of your taxable income and deduct all of your monthly debt payments, including car loans, credit cards, lines of credit payments. The lesser of the first or second calculation will be used to help determine how much of your income may be used towards housing related payments, including your mortgage payment. These calculations are based on lenders' usual guidelines. Lenders normally allow up to 49.9% for conventional loans or 57% for government loans.
In addition to considering what the ratios say you can afford, make sure you calculate how much you think you can afford. If the payment amount you are comfortable with is less than 50% of your income you may want to settle for the lower amount rather than stretch yourself financially. Make sure you don't leave yourself house poor. Structure your payments so that you can still afford simple luxuries.