Four cities — Calgary, Edmonton, Brampton, Ont., and Victoria, B.C. — fell into the “borderline” category. Middle-income earners in these cities could soon be priced out of the single-family home market, if prices there continue to grow faster than income, as has been the case in all of them except Victoria. (Prices there have been falling slowly for years.)

Among those cities were many formerly affordable suburbs, including Markham and Mississauga (greater Toronto), and Burnaby and Surrey (greater Vancouver).

Of the 26 largest cities in Canada, seven fell into the “unaffordable” category — meaning the average sale price of a stand-alone home was at least $100,000 more than the maximum mortgage amount an average income will get you. (See methodology below.)

And while Toronto and Vancouver are famous for their high house prices, HuffPost’s survey shows those cities’ traditionally affordable suburbs are now out of reach for middle-income earners as well. In these cities, average earners have basically no choice but to buy a condo, or stay out of the housing market.

Average-income families can no longer afford a detached house in more than a quarter of Canada’s largest cities, according to an analysis carried out by The Huffington Post Canada.

With house prices growing rapidly thanks to rock-bottom interest rates that have made mortgage payments more affordable, developers have been shifting to condo construction to build affordable housing.

“In the 1990s, you might have four or five single detached for every row house, now it’s more like three to one,” BMO economist Doug Porter said in a recent interview with the National Post, adding that the trend "is becoming even more obvious in recent years."

But it's not just prices, it's a lack of supply. In Toronto and Calgary in particular, there are simply too few single-family homes for sale to meet demand. Scotiabank economist Adrienne Warren says Calgary will be able to meet future demand through construction, but Toronto faces a different problem: It's running out of space to build houses, thanks to policies, such as the Green Belt, meant to reduce urban sprawl.

The measures seem to have worked; Greater Toronto is moving towards higher-density housing, so much so that it leads North America in high-rise construction, with 50 per cent more being built there than in New York City (though that could be a sign of overbuilding). But one unintended consequence appears to be a serious decrease in the affordability of detached homes.

How we determined what's affordable

To determine whether or not middle-income earners can afford a detached home in a given market, HuffPost took the average household income for all Canadians — estimated at $87,000 annually, based on StatsCan data — and polled a handful of mortgage experts to see what that income would get you, in terms of a mortgage.

The average of the mortgage experts’ estimates came to $460,000 — that’s what you can borrow, assuming a household income of $87,000, a 25-year amortization period, a 5-per-cent down payment, no other debts and current mortgage rates.

Any market where the average price of a detached house is more than $100,000 above the $460,000 mark we define as “unaffordable.”

You might still be able to buy a standalone house in these markets for a middle-income wage (even in super-pricey Toronto you can still buy a house, every now and then, for an average income) but at these price levels you’re almost certain to get a substandard home in a less desirable area.

Any market where the average price of a house is above the maximum mortgage middle earners can get, but by less than $100,000, is defined as “borderline.” There are still houses here that middle earners can afford, but not many.

All other housing markets are defined as “affordable.”