top of page
  • Writer's pictureMark Fonville, CFP®

How Capital Gains Tax Is Calculated

Updated: Nov 18, 2023

How Capital Gains Tax is Calculated

If you have investments outside of tax-advantaged retirement accounts (401k, IRA, etc.), it’s critical to consider how the gains on those investments are taxed.

But, understanding how capital gains tax is calculated isn't always straightforward.

The tax rules aren’t as simple as a Roth or tax-deferred retirement account, where you only have to pay tax on the front end or the back end.

Gains earned along the way are potentially subject to capital gains tax, which is different from ordinary income tax. Understanding the nature of capital gains tax—what it is, how it affects you, and how it is calculated —could help you plan a more comprehensive investment strategy.

Taxes are critical year-round, but there are particular rules you should consider before year-end.

What impacts capital gains taxes, and how do you calculate your rate before tax time?

Here’s what you need to know about how capital gains tax is calculated by the IRS.

What Is Capital Gains Tax? Understanding Short and Long Term

First, it is essential to understand what a capital asset is before calculating its tax burden.

Capital gains can apply to investments such as stocks, bonds, real estate, cars, boats, cryptocurrency, collectibles, home sale, and other tangible items. If an investment is worth more than your cost basis (typically, your basis is what you paid for it) then, you have a capital gain in that investment. If an investment is worth less than your cost basis, you incur a capital loss.

While you still own that investment, the gain is said to be unrealized. Presently, you do not incur a tax liability on unrealized capital gains.

For example, if you paid $100 for a stock that is now worth $125. You have an unrealized gain of $25.

However, if you sell the investment, the gain transitions from unrealized to realized; realized capital gains drive capital gains taxes. Your tax bill is based on the realized gain and not simply the amount of your investment. So, if your purchase price was $100 and the sale price was $125, you’d have to pay capital gains tax on $25.

The length of time you hold the investment before you realize the gain makes a significant difference in your tax bill, too. Your gain can be taxed as either a long-term or short-term capital gain.

Tax rates on long-term capital gains for 2022
  • Long-term capital gains tax: Favorable long-term capital gains tax rates apply only to profits from the sale of assets held for more than a year. The rates are 0%, 15%, or 20%, depending on the taxpayer's taxable income and filing status (single, married filing jointly, head of household, etc.) for that year.

  • Short-term capital gains tax: Short-term capital gains tax applies to assets held for a year or less and are taxed as ordinary income. For many taxpayers, that is a higher tax rate than the capital gains rate.

Here are the 2022 Federal tax brackets that apply to short-term capital gains in 2022:

2022 federal tax brackets for short-term capital gains.

But, a lot of people don't realize that capital gains can trigger additional taxes on top of long-term and short-term capital gains tax. You'll need to understand two more tax triggers to really understand how to calculate capital gains tax on your investments.

For those with significant capital gains (and high-income families), you may also be subject to the 3.8% net investment income tax and a very sneaky tax called the income-related monthly adjustment amount or IRMAA. The IRMAA tax is an added cost to Medicare premiums in retirement and many retirees miss this entirely before it's too late.

Both the net investment income tax and IRMAA can potentially cost you tens of thousands of dollars in additional taxes if you aren't careful with how you calculate capital gains taxes.

Ultimately, understanding the difference between short and long-term capital gains, and planning accordingly, can help you pay less in taxes. This can go a long way toward increasing the after-tax return on your investments.

How to Calculate Your Capital Gains Taxes

Now that you understand what a capital gain is and the difference between long and short-term capital gains, let’s look at how the capital gains tax is calculated. The key here is to understand that your tax liability rests on your net capital gain.

First, list out all the money you made by selling investments (like stocks, bonds, cars, other tangible items).

If you held any assets for a year or less, mark those up to short-term capital gains and know they will be taxed at your standard income tax rate. If you held any assets for more than a year, they would be subject to taxation at the lower long-term capital gains rate.

However, you won’t necessarily pay capital gain taxes on that entire amount. The next thing to do is tally up all of your realized investment losses for the year. That amount is taken out of your realized capital gains, and the result is the final amount that will be taxed.

For a simple example, assume you realized a $10,000 gain by selling a stock but lost $3,000 selling another; the difference would be $7,000.

That difference is called your net capital gain, and you’ll owe taxes on that number.

Does Realizing Long-term Capital Gains Push You Into A Higher Tax Federal Bracket?

The short answer?


Capital gains and ordinary income are taxed on separate systems, so realizing capital gains won’t increase the amount you need to pay in ordinary income tax.

But, what realizing capital gains can do is boost your adjusted gross income, a critical figure used to determine your eligibility for tax credits and tax deductions, ability to contribute to a Roth IRA, and more. And as we outlined above, higher adjusted gross income can also trigger the net investment income tax and IRMAA.

Just like income tax brackets, capital gains tax brackets change slightly from year to year. You can check brackets each year in helpful tax cheat sheets such as the one here.

Because long-term capital gain tax rates are generally lower than income tax rates, and you can control when you realize gains, it makes sense to incorporate tax-planning strategies around your taxable investments. If your net capital gain is under a specific dollar amount (depending on how you file), your tax rate could even be 0%.

If you have taxable investments, you may want to try out one of the strategies below.

How to Avoid Capital Gains Tax on Stocks or Other Assets

So how do you use what you now know about how to calculate the capital gains tax to lower your tax bill?

There are several ways you can avoid higher capital gains taxes.

1. Don't Sell Your Assets.

The most straightforward? Don't sell your assets. If you never realize gains, you never incur a tax liability. Of course, it’s impractical to think you’ll never realize gains. After all, that's the whole point of investing, right?

But it is reasonable in many cases to hold on to investments for at least one year. By adhering to the holding period, you'll be taxed at the long-term capital gains rates, not your average income rates.

Of course, it’s pivotal to understand that taxation shouldn’t always be your primary concern either. If you have concentrated stock or need to rebalance your portfolio, don’t let a tax liability keep you from adjusting your allocation to avoid taking too much investment risk.

2. Consider Selling Your Investment Over Time

It's common for us to advise clients who have highly appreciated stock that is heavily concentrated in a handful of positions. This means that they have a potentially large tax liability if they sell, but if they don't sell the position the are putting their assets at risk. We've seen countless scenarios where investors have too much money in a single stock, they don't sell for tax reasons, and then they subsequently lose 50% or more of their investment when the company doesn't perform as hoped.

So what can you do to reduce the impact of capital gains tax on low-cost basis stock position? Consider selling the position over time. Timing the sale of your investment over several years can help keep your capital gains tax low while also reducing the risk of having too much money in a single position.

3. Use Tax Sheltered Investment Vehicles

When possible, use tax-advantaged accounts like Traditioonal IRAs, Roth IRAs, and 401(k)s to the fullest. Since these accounts are sheltered from taxes until you withdraw funds (Roth IRAs are not taxed upon withdrawal), you won’t incur capital gains taxes if you sell investments within them. The longer you hold assets, the more significant the impact the tax shield will have.

4. Wait Until You Retire When You're In a Lower Tax Bracket

If you are near retirement, consider waiting until you stop working to sell profitable assets. If you expect your taxable income to drop in retirement when your paychecks stop, the capital gains tax bill might be reduced. This could be an excellent strategy to help reduce taxes in retirement.

5. Consider Tax-Loss Harvesting

Lastly, consider selling an investment at a loss that you wanted to get rid of anyway. Doing so can offset your profits and reduce your net taxable gain. This strategy, known as tax-loss harvesting, can be a valuable tool in offsetting capital gains taxes elsewhere in your portfolio.

But, be careful as the rules are complex and we always recommend that you talk to a tax planning advisor prior to implementing any tax strategy.


Understanding how capital gains tax is calculated is paramount for any investor who wants to preserve wealth prior to and during retirement.

Once you know how to calculate the tax on your capital gains, you'll be better equipped to identify strategies that help reduce the taxes you have to pay.

Strategies such as holding the investment long-term, selling the investment over time to spread out the gains, and owning investments within tax sheltered investment vehicles may help reduce your tax liability.

You may also want to consider taking advantage of lower tax brackets upon retirement to realize capital gains.

Knowing how the capital gains tax is calculated is a great first step to lowering your tax bill each tax year.

But there is a lot more to tax strategy when it comes to your investments.

Understanding how capital gains will impact you often requires expert tax advice and powerful long-term capital gains tax calculators to help make the best decision for your situation.

If you need help understanding and planning around capital gains taxes, we can help.

Covenant Wealth Advisors can help you calculate your capital gains tax, as well as discuss the best strategies to help reduce taxes on your investment portfolio.

Give us a call, and we will be glad to help you get started.


About Mark Fonville, CFP®

Mark is a personal financial advisor and the President of Covenant Wealth Advisors. He manages investment portfolio and provides retirement income planning for individuals age 50 plus who have over $1 million in investments.

He has been featured in the New York Times, Barron's, Forbes, and Kiplinger Magazine. Schedule a call.



Covenant Wealth Advisors is a registered investment advisor with offices in Richmond and Williamsburg, VA. We provide investment advisory, financial planning, and tax planning services to individuals. Investments involve risk and does not guarantee that investments will appreciate. Past performance is not indicative of future results.

The views and opinions expressed in this content are as of the date of the posting, are subject to change based on market and other conditions. This content contains certain statements that may be deemed forward-looking statements. Please note that any such statements are not guarantees of any future performance and actual results or developments may differ materially from those projected.

Please note that nothing in this content should be construed as an offer to sell or the solicitation of an offer to purchase an interest in any security or separate account. Nothing is intended to be, and you should not consider anything to be, investment, accounting, tax, or legal advice. If you would like accounting, tax, or legal advice, you should consult with your own accountants or attorneys regarding your individual circumstances and needs. No advice may be rendered by Covenant Wealth Advisors unless a client service agreement is in place.

Registration of an investment advisor does not imply a certain level of skill or training.


Don't Miss Out

Join 8,067+ individuals who receive our retirement insights by email and get a free copy of "Key Issues To Consider Before You Retire."

bottom of page