Leveraging the tax code: How to pay 0% capital gains tax

Leveraging the tax code: How to pay 0% capital gains tax

Jake Skelhorn
March 22, 2024

It’s no secret that the government wants to take a piece of the pie almost anytime money or property “changes hands” in our country. Sales tax, income tax, property tax, self-employment tax - the list goes on. Selling an asset such as real estate, stocks, bonds, business property, etc. for more than you bought it for is no exception… or is it? There are ways to avoid paying capital gains taxes at all, but first a bit of capital gains tax 101:

Capital gains taxes come in two flavors: short-term and long-term.

  • Short-term capital gains apply to assets sold less than 1 year after they were bought and are taxed at the same rate as your marginal income tax bracket.
  • Long-term capital gains apply to assets sold more than 1 year after they were bought, and are taxed at preferential rates: 0%, 15% or 20% depending on income.

It’s important to note that taxes only apply to realized capital gains, which only occurs when the asset is sold. If you buy a stock for $100 and it appreciates to $120 but you continue to hold it, no capital gains taxes are owed since the gain is unrealized.

Lower tax rates for long-term capital gains creates an incentive to invest for the long-term, which, at least in reference to the stock market, has historically paid off. In my opinion, this is the government’s way of trying to save investors from their own short-sighted speculation, but I digress.

So, why are capital gains taxes important to understand? 

They affect investment returns (and thus long-term goals)

In the context of investment accounts, capital gains taxes can significantly affect your after-tax returns - that is, your return on investment after you pay your dues. In a standard brokerage account (also referred to as a taxable account, after-tax account, non-retirement account), rebalancing your investments can cause taxable gains. Afterall, to avoid concentrating your portfolio in any one asset class, sector of the market, or specific holding, you generally want to sell the “winners” and buy more of the “losers” every so often. As you sell these winners, you will have to pay taxes on the gains, effectively reducing your return by whatever your capital gains tax rate is. 

For example, if your portfolio has increased from 500K to 550K this year, that’s a 10% return, but if you had to pay 10,000 in capital gains taxes to rebalance (realizing capital gains), then your after-tax return is only 8% (50K - 10K taxes / 500K). Over decades, this can have a compounding effect and result in much lower future balances.

Capital gains increase your Adjusted Gross Income

Capital gains also increase your adjusted gross income, or AGI, which is a figure that can have ripple effects if too high, like making you ineligible to contribute to a Roth IRA, create Medicare surcharges, and causing social security income to be taxable.

For example, if you’re single and make $90,000 in total income, you’re well under the phaseout limit to contribute to a Roth IRA ($146K-$161,000). However, let’s say you sell an investment property and realize a gain of 200,000. Now your AGI this year is $290,000 and can not contribute to a Roth IRA until next year when your income drops again, all else equal.

They allow you to control your taxable income

With strategic planning, there are ways to control your capital gains rates and even pay 0% in capital gains taxes, especially in retirement when you have more control over your income sources than your working years.

How to pay 0% in Capital Gains Tax

Keeping your AGI within the 0% LTCG bracket

As we can see in the chart above, you can earn up to $94,050 in 2024 (Married Filing Jointly) and pay ZERO capital gains taxes on assets held longer than 1 year. Let’s unpack this number a bit more though. 

First, let me emphasize that this figure applies to long-term capital gains. For short-term capital gains, you can only earn a mere $22,000 (2024, MFJ) before you start paying capital gains taxes. Not ideal. 

Second, $94,050 is your adjusted gross income, which consists of not only capital gains, but includes income from employment, rental income, passthrough business income (LLC, Sole proprietorship), dividends, interest, retirement withdrawals, and more. If you have any of the above, the wiggle room left in that $94,050 “bucket” can dwindle quickly. With that said, AGI is still pre-deductions, so (continuing with our married filing jointly numbers) a couple can earn up to $29,200 in ordinary income essentially tax-free on top of your capital gains!

One of the important factors in keeping your capital income within this bracket is having control over your income, which is more easily done in retirement than working years. As a retiree, you will likely have social security income and/or a pension serving as your income “floor”. After that, you likely have a few different buckets, or accounts, that you can withdraw from to satisfy your annual income needs: IRAs, 401ks, bank accounts, and brokerage accounts. 

The order in which you withdraw from these accounts can make all the difference in how much you can spend in retirement without running out of money, as well as your lifetime tax liability. In other words, it’s not just about paying as little in taxes this year, but the total amount paid in years ahead.

Selling your primary residence

Under a Section 121 exemption, the IRS allows you to sell your primary residence and exclude a portion or all of your gains from capital gains taxes. For single filers, the exemption amount is $250K, for married couples it is $500K, and of course, there are rules to qualify.

Ownership & Use Tests

To qualify for a Section 121 exemption, you must have lived in (used) and owned the property for 2 of the last 5 years prior to its sale. Surprisingly, you can satisfy both tests in 2 separate 2 year periods, but both must fall within the 5 year period. 

Capital Improvements

Remember, your cost basis can also increase above what you actually paid for the home. Capital improvements such as remodels, extensions and anything that reasonably increases the value of your home can be added to your cost basis, reducing your capital gain. 

For example, if a single person purchased a home for $300K, lived in it for 5 years, and sold it for $600K, you’d normally be able to exclude $250K of the gains from taxes, and only pay taxes on $50K. However, if you paid $50K to renovate your home while living there, then your cost basis would be increased to $350K, allowing you to exclude the full gain from taxes. 

The idea here is that you already paid taxes on the money you used to renovate your home, so the IRS is giving you a pass on that money being taxed again. How gracious!

Invest in Tax-Advantaged Accounts

So far we’ve discussed capital gains taxes as they apply to selling stocks, bonds, mutual funds and other investments in a regular brokerage account. However, this is essentially the only investment account that capital gains applies to.

Retirement accounts like 401(k)s, 403(b)s, 457s, Thrift Savings Plans, IRAs, Roth IRAs, and even Health Savings Accounts (HSAs) and 529s are all considered tax-advantaged accounts. What all of these accounts share in common is that capital gains taxes simply do not apply to them. That’s right, you can realize any amount of capital gains inside of these accounts and not pay any capital gains tax - it’s not even reported to the IRS. Taxes only apply to these accounts either before money goes in as a contribution, or as it comes out as a withdrawal.

With this in mind, it makes sense that most common knowledge says to prioritize these accounts for long-term investing goals like retirement before investing in a “taxable” brokerage account. Capital gains taxes can’t eat away at your returns in these accounts, allowing more of your money to compound over time.

1031 Exchange

Property used for trade in a business or as an investment may qualify for what is known as a like-kind exchange. Under IRC Code 1031, you can exchange a property that has appreciated in value for another similar property and transfer the unrealized capital gains with it. There are strict requirements to qualify for a 1031 exchange: a new property must be identified within 45 days of the transfer of the current property, and the new property must be received by the earlier of 180 days from the transfer or by tax filing deadline for the year of the transfer. Admittedly, this is less of a way to “pay 0% capital gains tax” and more of a way to defer taxes to a later date, but an important strategy to understand nonetheless, especially for large real estate deals.

Step-Up in Basis 

Outside of the aforementioned tax-advantaged accounts, when the owner of an asset dies, their heirs receive the assets at a “stepped-up” cost basis that is determined as the market value of the asset at the time of their death. 

For example, let’s say your mother owns $1,000,000 worth of stock in a brokerage account that she paid $10,000 (cost basis) for many moons ago. As her beloved son or daughter she lists you as the beneficiary of the stock, and sadly eventually passes away. If she would have sold the stock prior to her death, she would have realized $990,000 in capital gains and had a six-figure tax bill. However, assuming the stock was still worth $1,000,000 at the time of her death, the stock will transfer to your name with a cost basis of $1,000,000 instead of $10,000! This means if you sell the stock immediately, you’d owe zero capital gains taxes (again, assuming you sell for $1,000,000.)

Capital Losses

So far we’ve talked about capital gains, since you’re only taxed when you actually make money on the sale of an asset.  What happens when you lose money? Thankfully, the IRS does not impose any taxes on the proceeds of a capital loss. Afterall, it’s just considered a return of (some) of the money you already paid taxes on. 

That doesn’t mean capital losses are totally useless though. On the contrary, capital losses can actually offset capital gains, reducing or eliminating any capital gains taxes owed. This is commonly referred to as tax-loss harvesting.

Let’s say you need to make a planned withdrawal of $20,000 from your brokerage account and you have a handful of investments to choose from to liquidate. ABC Stock is worth $10,000 but has a $2500 unrealized gain. XYZ Stock is worth $10,000 but carries a $2,500 unrealized loss. By selling $10,000 of ABC stock (realizing a $2500 gain), and selling $10,000 of XYZ stock (realizing a $2500 loss) you’ll pay no capital gains tax, since the gain and loss offsets. 

What’s even better is that if your losses exceed your gains in a given year, you can deduct up to $3,000 off of your ordinary income and any unused amount is carried forward to future years to apply to future capital gains or ordinary income, known as a carryover loss.

Wrap Up

To sum everything up, capital gains taxes can either be a blessing or a curse, depending on how you work around them. It’s important to always know which income tax bracket, and thus capital gains tax bracket, you are in in any given year when making decisions about buying or selling investments or property.

A few common ways to pay 0% in capital gains tax are:

  • Controlling your AGI to stay within the 0% long-term capital gains bracket
  • Utilizing the Section 121 exclusion (selling primary residence)
  • Invest in tax-advantaged investment accounts
  • 1031 Exchange (Exchanging investment property)
  • Step-up in basis at death
  • Offsetting with capital losses

As with financial planning in general, capital gains taxes are unique to your situation, short and long term goals, and priorities. The goal may not always be to pay as little in taxes as possible, but it’s an important consideration when making big financial decisions. Consult with a CPA, tax attorney, or experienced financial planner to assess the tax implications of such decisions.