Benjamin Franklin once famously proclaimed, “In this world nothing can be said to be certain, except death and taxes.” Well, good-ole’ Benji mustn’t have had much in the way of real estate investments. Capital gains taxes on investment properties are no guarantee. In fact, investors often are able to defer these taxes perpetually.

Capital gains are the profits from the sale of an asset—or the sales price less the purchase price—and they come with a hefty tax of 15% to 20%, depending on your annual income and tax filing status. Luckily, real estate investors have a handful of tools to kick capital gains taxes down the road in perpetuity. Here are the three best ways to bypass your capital gains tax bill on real estate investments.

The 1031 Exchange

A 1031 exchange is a classic. It is easily the most popular way for real estate investors defer capital gains taxes. Through a 1031 exchange, investors can avoid the tax on the sale of an investment property by reinvesting the proceeds into the acquisition of another asset of equal or greater value. Or, more simply, you can exchange one property for another without triggering a taxable event.

Following the sale of an asset, an investor has 45 days to identify a new investment property and 180 days to complete the transaction. In the interim, the proceeds from the sale are held in a qualified intermediary account until the transaction is complete. It’s important to note that the investor must initiate a 1031 exchange before selling a property. You can’t sell a property and decide later to do a 1031 exchange, even if you are in the 45-day window.

According to the tax code, investors can exchange like-kind properties, which simply means trading one real estate property for another real estate property rather than another type of investment, like Bitcoin. As a result, there is a lot of flexibility in what investors can exchange. They can trade an asset for any other asset class—whether residential to retail, or office to industrial, or a hotel into vacant development land. All is fair game.

In addition to capital gains tax deferral, a 1031 exchange also allows investors to avoid depreciation recapture in most cases, as Keith Wasserman discussed on the Master’s of Real Estate podcast.

The Reverse Exchange

If finding a replacement property in a 1031 exchange seems too stressful, you’re in luck. The IRS allows real estate owners to complete a reverse 1031 exchange. Just like a standard 1031 exchange, investors can avoid capital gains tax by trading one real estate asset for another; however, in this process, the investor buys a replacement property before selling the exchange asst.

In reverse exchanges, all of the same rules apply. The investor has 45 days to identify an exchange property and 180 days to complete the transaction. During the transaction, the acquired property is held by a single-purpose intermediary entity, typically an LLC, and the property is released once the exchange property is sold.

The like-kind exchange parameters also apply to reverse exchanges, meaning that the investor must exchange real estate assets. As long as that obligation is met, the investor will enjoy the same flexibility in trading any real estate asset class or land site in a reverse exchange.

The UPREIT

Similar to the 1031 exchange, a 721 exchange, or as it is more commonly called an UPREIT (an acronym for umbrella partnership real estate investment trust), allows real estate investors to contribute a property to a REIT’s operating partnership in exchange for units of that operating partnership, rather than cash. Like a 1031 exchange, this transaction does not trigger a taxable event and is a way for real estate owners to defer capital gains tax on the sale of an asset.

While much less common than a 1031 exchange, UPREITs have their own advantages. By owning units in the operating partnership, the investor will benefit from the REITs entire property portfolio, not only a single property. REITs also routinely pay dividends, either monthly or quarterly, so investors will continue to see steady cash flow, but without the property management and administrative responsibilities of operating a real estate asset.

So, what’s the catch? An UPREIT deal can be hard to pull off. The exchange property must fit the REIT’s investment strategy, and that typically means a high-quality, institutional-grade asset. Investors also need tread lightly. Any changes—say you convert the operating units into REIT stock or the REIT sells off the entire portfolio—will trigger a taxable event, and a capital gains tax bill will arrive soon after.

The Opportunity Zone

The newest tax deferral tool on the block, opportunity zones are perhaps the best way to elude capital gains taxes altogether for those willing to play the long game. The opportunity zone program was created as part of the 2017 tax reform bill to catalyze real estate investment in economically distressed markets—but the model also comes with massive tax benefits.

You can invest net capital gains from the sale of any investment asset—real estate, stocks, art, wine, bonds—into a qualified opportunity zone fund and defer capital gains taxes temporarily until the sale of the asset. The real benefit, however, comes a decade later. If the qualified opportunity zone fund holds the investment for at least 10 years, investors are permanently exempt from paying capital gains taxes on the sale of the asset. Alternatively, investors can remain in the investment through 2026 and receive a 10% deduction in capital gains tax for qualified opportunity investments made by the end of 2020. Unlike the other tax deferral models, opportunity zone investments allow investors to ultimately realize the capital gain without triggering a taxable event. To take advantage of this opportunity, investors must invest in a qualified opportunity zone 180 days after the sale of an asset.

Opportunity zone projects require that the fund make a substantial improvement to the existing property or complete a ground-up development. To meet the standard of a substantial improvement, investors must double their adjusted basis in the property during any 30-month period that they hold the property. While the regulations for opportunity zone investments are steep, they are the burden of the fund operator—usually an experienced and savvy real estate investment company—not the individual investors in the fund. There are more than 8,000 opportunity zones in the US, and while opportunity zone projects are still new, they are already tremendously popular. Qualified opportunity zone funds have already raised as much as $45 billion for investment.