To buy or to rent is the question. Majority of people think the time is ripe to buy a house, says the latest Fannie Mae Housing Survey. However, several factors have to be analysed before investing in a house.  

Real estate information provider zillow.com in its study stated that in most U.S. cities buying becomes a better option than renting only after three years of residence.

This study, which covered more than 200 metros and 7,500 U.S. cities, finds that in 75 percent of metros, owning a house is a viable option than renting, as a homeowner would break even after three years or less of owning a home.

So how do you find where it's better to rent and where to buy? All that depends on the breakeven horizon - the number of years one would need to own and live in a home until it becomes financially advantageous than renting the same home.

In metros where home values are high, it took home buyers more number of years to break even. For instance in the San Jose metro, where home values are among the highest in the nation, a buyer must commit to living in the home for 8.3 years before breaking even. In other metros where home values fell in the recent past, buyers broke even after less than two years of owning a home. In the Miami-Fort Lauderdale metro, it took only 1.6 years to break even. In Tampa, too, it took homebuyers just 1.6 years.

"Across most of the country, historic levels of affordability make buying a home a better decision than ever, especially considering rents have risen more than 5 percent over the past year," said Stan Humphries, Zillow Chief Economist, in a statement.

"This is the first analysis of metros and cities that presents the buy versus rent decision in an intuitive way, by telling consumers how long they must live in the home before buying breaks even with renting financially," he said.