(Shutterstock)

(Shutterstock)

You might feel like you’ve missed the boat on being able to afford your own place in D.C.’s housing market, but it still may not be too late.

With the rapid growth of many neighborhoods, D.C. is quickly becoming one of the most expensive cities in the nation to live in. But despite that fact, it’s still cheaper to buy a home in D.C. than it is to rent, according to a new report from Trulia.

According to the report, it is 31 percent cheaper to buy a house in the D.C. area than it is to rent. “How can that be?” You may be asking yourself. “The housing market in D.C. is soooo expensive,” you say. Well, you’re not wrong. But as outlined in the report, Trulia came up with a specific formula to determine these findings. The formula calculated a variety of factors that vary from city to city, including:

1. Calculate the average rent and for-sale price for an identical set of properties. For this report we looked at all the homes listed on Trulia for sale and for rent from June to August 2013. We estimate prices and rents for similar homes in similar neighborhoods in order get a direct apples-to-apples comparison. We are NOT just comparing the average rent and average price of homes on the market, which would be misleading because rental and for-sale properties are very different: most importantly, for-sale homes are roughly 50% bigger, on average, than rentals.

2. Calculate the initial total monthly costs of owning and renting, including maintenance, insurance, and taxes.

3. Calculate the future total monthly costs of owning and renting, taking into account price and rent appreciation as well as inflation.

4. Factor in one-time costs and proceeds, like closing costs, downpayment, sales proceeds, and security deposits.

5. Calculate the net present value to account for opportunity cost of money.

They even put together this nifty interactive map that shows what percent cheaper it will be for you to buy a home in a given area based on factors like your mortgage rate, income tax bracket, and the amount of years you plan to spend in your home. So, for example, if the mortgage rate I could get on a on a thirty-year fixed-rate loan was six percent, my income tax bracket was 15 percent, and I planned on being in a home for at least seven years, it would only be 16 percent cheaper for me to buy a home than to rent.

Of course, rising mortgage rates are rapidly making it more expensive to buy a home, and the national average of what it costs to buy a home than to rent has dwindled by ten percent in just one year:

But rising mortgage rates have narrowed the gap between the cost of buying and the cost of renting. The 30-year fixed rate is now 4.80%, compared with 3.75% one year ago (according to the Mortgage Bankers Association, or MBA). This jump in rates has raised the cost of buying relative to renting. As a result, buying is 35% cheaper than renting today, versus being 45% cheaper than renting one year ago.

Basically, if you’re thinking of buying a home in D.C. better act fast, because it’s not getting cheaper.