First, the wonkish answer. Considering financial costs only, the cost of renting is simply your 1) Actual rent + 2) Renter's insurance + 3) Difference in uncovered utilties between a rental and owned property. This sum can be compared to the financial cost of ownership of a nearly identical property. This is tougher to precisely quantify, and includes many subtle (yet considerable) costs often overlooked. But regardless, it's good to be qualitatively aware of them all. I'll start with the simple ones. Please note that none of the following is building any equity or savings. It's all money permanently out the door.
A) HOA Fees.
B) Homeowner's Insurance.
C) Property Taxes. To get the true cost, multiple by (1 - Your marginal tax bracket). This is a reasonable approximation. Even if you currently take the standard deduction, you would likely itemize as a homeowner. As with all tax write-offs, it's important to remember not to let the tax tail wag the investing dog.
D) Interest on Mortgage. As you pay off your mortgage, this will decrease because each monthly payment (presumably constant) will consist of interest calculations on a progessively smaller outstanding principal balance. As in C), adjust downward based on your tax bracket due to its deductability.
E) Opportunity Cost of Equity in Home. As you pay off your mortgage, this will increase. Consider what you could earn on the cash tied up in your home in a medium-term CD at a FDIC-insured commercial bank. Of course it's better to have equity and "lose" this rate than have a mortgage and pay a higher rate (this spread is how banks make money after all). So if you have the cash and won't need it for anything important in the near future, I recommend foregoing the mortgage completely. Leveraging yourself to invest in risky assets is a bad idea. As before, adjust downward due to the taxability of interest income.
F) Transaction's Costs. Depending on where you purchase, as well as the complexity of your deal, these can be substanitial. Typically, the largest one by far is a broker's commission. An often heard mantra is "You don't pay a commission, the seller does." This is misleading at a minimum, even if technically true. The 5-6% commission is paid by the seller to the seller's agent, who typically then splits it with the buyer's agent. However, if the seller didn't have to pay this commission, he/she would be able to offer you as the buyer a lower price - so effectively this is a cost to both parties to the transaction. Other transaction's costs may include transfer taxes, legal fees, and closing costs. So conservatively speaking, unless you do a FSBO (for sale by owner, i.e. no broker on either end) deal, these costs can total 7-8% of your purchase price. This means the value of your property has to appreciate by at least 7-8% just for you to break even. Imagine if this were true in the stock market. Consider AAPL's current price of 113.28 / 113.29. That means that you can instantly buy AAPL for 113.29 and sell it for 113.28, i.e. a Bid-Ask spread of just a penny - less than 0.01% of your investment. Now imagine a 7% Bid-Ask spread, i.e. 109.32 / 117.25. Now you have to pay 117.25 for a share of AAPL stock, and if you decide to immediately thereafter sell this share, you only get 109.32. Would you touch this investment? Well maybe, but you'd think a lot harder about the underlying valuation. There would have to be substantial benefits to ownership.
G) Maintainance / Depreciation. Unless the property under consideration is a plot of land, the structure (e.g. roof) and the things inside (e.g. appliances) will inevitably depreciate. Even if you determine that nothing will need upkeep/replacement before you sell the property, the resale value will reflect the diminished value.
H) Risk and Liquidity Premium. I won't dwell on this, but uncertain costs (in contrast to rent) should demand a risk premium. And an illliquid asset (in contrast to a savings account or shares of an index fund) should demand a liquidity premium. Economic downturns often result in simultaneous housing downturns and mass layoffs, and when they occur, consider how this would affect your ability to leave for greener pastures. We saw in 2008-09 how labor mobility suffered because too many people were underwater on their homes, and/or didn't want to sell at a loss. At a minimum, consider this a tie-breaker in favor of renting if you find the costs of renting and ownership to be very close.
I've obviously ignored something very important thus far: the potential for price appreciation. If you strip away everything above, that's what remains, and it can more than make up for the costs above. This is speculation, and if you have a strong opinion on the direction of the housing market, there's a much, much, much simpler way of capitalizing on that. Also it comes with the nice little perk of not spending time working with brokers, lawyers, condo associations, and local tax authorities. You can participate in the potential upside by buying a equity REIT fund. It's not only liquid enough to be disposed of in less than a minute, but gives you a super diversified portfolio of holdings as opposed to one type of property in one neighborhood in one city, etc. As an aside, (inflation-adjusted) housing prices appear flat in the long-term.
A commonly heard facile argument in favor of buying is "You're building equity when you buy, whereas you're throwing money down the drain when you rent." If you hear this, it's a very strong indication that the person speaking has no idea what they're talking about (sorry but it's true). I hope the above list of costs show that you are "throwing money down the drain" regardless of whether you rent or buy. The question is which decision results in a smaller outflow - and it may very well be buying! If my arrogance hasn't convinced you, consider that if the above argument were valid, one should rationally purchase property at any price. Intuitively, we know that can't be right. The price you pay does matter, even if some bank is willing to lend you 100% of the purchase price on an infinite-term loan. Buying is renting. The difference is you're paying rent to a bank (for lending of money) instead of rent to a landlord (for lending of property). And if you don't have a mortgage, then you are foregoing a large amount of potential investment income. Either way, there are large costs in play. A home is an asset and a liability.
Regardless of what decisions the above calculations yield, I believe that in the end, one should buy a home for the same reason he/she buys most things - because it brings happiness. For example, I really, really like trapezoids. And my bedroom is shaped like one. Believe me or don't, if it was a rectangle, I'd still be renting. Ultimately, I think a home should be a place to raise your kids, throw parties, paint the walls ridiculous colors, or install an adult moonwalk bounce house in your pleasure playroom hidden behind a camouflaged door only your spouse knows about. If you're looking for a good financial investment, you can often do a lot better.