NEW YORK ( TheStreet) -- The old rule of thumb says: Don't buy a home unless you'll stay there for four or five years -- long enough for appreciation to offset expenses such as the real estate agent's commission when you sell. If you won't have the home that long, rent. But conditions can alter that time horizon, and a study by Zillow ( Z), the mortgage and housing data firm, shows how dramatic the variation can be. Taking the analysis down to individual neighborhoods and ZIP codes in 30 metropolitan areas, Zillow finds that the break-even point can be as long as the 20.3 years in the Sandbridge area of Virginia Beach, Va., and as short as one year in Memphis, Tenn. Nationally, the break-even is three years or less in 64% of the metropolitan areas. Why so much shorter than the four- to five-year rule of thumb? Mainly because home prices, though rising, remain well below their peaks of six or seven years ago, while mortgage rates are at near record lows, making homes very affordable. Meanwhile, rents have been rising because of high demand, largely from people nervous about buying or unable to qualify for a mortgage. Zillow has an interactive tool to display the break-even point and the neighborhood and ZIP code level. "Among the 30 largest metro areas analyzed by Zillow in the first quarter, those with the shortest break-even horizon were Miami (two years), Detroit (two years) and Phoenix (2.1 years)," Zillow reports. "Large metros with the longest break-even horizon in the first quarter included New York (5.2 years), Boston (4.1 years) and San Jose (3.7 years)." You can crunch your own numbers with the BankingMyWay Rent vs. Buy Calculator. Note that the calculation involves a number of inputs that can only be estimated, including the rate of home-price appreciation and rent increases, the inflation rate and the after-tax investment return on money that could be invested if you rent instead of buy. Zillow deals with these uncertain factors by looking at past patterns. There is, of course, no guarantee that Zillow's predictions will come true. Among the trickiest factors is the benefit the homeowner might get from the federal income tax deduction on mortgage interest. Some homeowners benefit a lot, others not at all. Zillow's tool can be a valuable aid in the rent-or-buy decision to get a general sense of conditions in any neighborhood where you are thinking of buying. You can refine your view by trying various inputs in the BankingMyWay calculator to see the dramatic effect of raising and lowering the home appreciation rate, for example. Also note that if you think you would have the home for a period close to the break-even point, there may be little financial difference between buying and renting. In that case, renting may offer enough convenience and flexibility to be the better choice. But if you really want to personalize the property, buying could be the better option. In the end, it probably makes sense to use a significant margin for error in case your plans change or the break-even calculation is off. Even if you conclude you can break even on a home purchase in three years, it still might make sense to rent if you're not certain you'd stay for four or five. Finally, keep in mind that although owning may make better financial sense than renting, this doesn't mean that a home you own is a good investment. Unless you live in an area with high home appreciation, other types of investments, such as stocks and mutual funds, might be more profitable. In that case, it could pay to buy a cheaper home instead of an expensive one.