It is easily the question most asked by anyone moving into their first home or downsizing into retirement. Should I buy or should I rent?

For nearly a decade the answer has been buy. The crash in home prices, combined with record-low mortgage rates made buying and owning a home both cheaper than renting one and a better investment.

Now, the tide has turned.

Fast-rising home prices and higher mortgage rates have shifted the calculation to rent. The monthly costs of buying and owning a home that you occupy are up 14 percent over the past year, more than three times the annual increase in rent rates nationally, according to realtor.com. Rents are up just 4 percent. The number of local housing markets where it is cheaper to rent than buy is growing by the day.

"Even setting aside big upfront expenses like a down payment, rising month-by-month costs are likely keeping many people from purchasing," said Danielle Hale, chief economist at realtor.com. "Today only 41 percent of people live in a county where the median-income family can afford to buy a home at the median list price, and affordability declined significantly over the past year."

Home prices fell dramatically after the financial crisis and the subprime mortgage crash. Millions of homes went into foreclosure and were sold off at bargain-basement prices. Home values finally bottomed out in 2012 and then began to take off. In the last three years, the gains accelerated dramatically, and now homes in most of the nation are worth more than they were at the inflated peak of the housing boom in 2006.