💰 Financial

How to Calculate Capital Gains Tax (Short-Term vs Long-Term)

Selling an investment at a profit is a great feeling, but the IRS wants its share. Capital gains tax is the tax you owe on the profit from selling an asset such as stocks, bonds, real estate, or other investments. How much you owe depends largely on one factor: how long you held the asset before selling it. Understanding the difference between short-term and long-term capital gains can save you thousands of dollars every year.

In this guide, we will break down exactly how capital gains tax works, walk through the 2026 federal tax brackets for both short-term and long-term gains, explain how to calculate your cost basis, and share practical strategies to legally reduce your tax bill.

What Are Capital Gains?

A capital gain occurs whenever you sell an asset for more than you paid for it. The gain is simply the difference between your sale price and your cost basis (the original purchase price plus certain adjustments). If you sell an asset for less than your cost basis, you have a capital loss, which can actually be used to offset gains and reduce your taxes.

Capital gains apply to a wide range of assets, including:

  • Stocks and ETFs held in a taxable brokerage account
  • Bonds sold before maturity at a premium
  • Real estate including rental properties and your primary home (with certain exclusions)
  • Cryptocurrency such as Bitcoin, Ethereum, and other digital assets
  • Collectibles like art, antiques, and precious metals
  • Business assets including equipment and intellectual property

Note that assets held inside tax-advantaged accounts like a 401(k), traditional IRA, or Roth IRA are not subject to capital gains tax when you buy and sell within the account.

Short-Term vs Long-Term Capital Gains

The IRS divides capital gains into two categories based on your holding period, which is the length of time between the date you acquired the asset and the date you sold it.

The Holding Period Rule

  • Short-term capital gains: Assets held for one year or less. Taxed at your ordinary income tax rate, which can be as high as 37%.
  • Long-term capital gains: Assets held for more than one year. Taxed at preferential rates of 0%, 15%, or 20% depending on your taxable income.

The difference is significant. If you are in the 32% tax bracket and sell a stock after 11 months for a $10,000 profit, you owe $3,200 in taxes. Wait one more month and that same gain might be taxed at only 15%, costing you just $1,500. That is a $1,700 savings simply by being patient.

The holding period is calculated starting the day after you acquire the asset. If you bought shares on March 1, 2025, you must hold them until at least March 2, 2026, for the gain to qualify as long-term.

2026 Long-Term Capital Gains Tax Brackets

Long-term capital gains are taxed at three rates: 0%, 15%, or 20%. The rate you pay depends on your total taxable income and filing status. Here are the approximate thresholds for the 2026 tax year:

Long-Term Capital Gains Rates (2026, Single Filers)

  • 0% rate: Taxable income up to approximately $48,350
  • 15% rate: Taxable income from $48,351 to approximately $533,400
  • 20% rate: Taxable income above $533,400

Long-Term Capital Gains Rates (2026, Married Filing Jointly)

  • 0% rate: Taxable income up to approximately $96,700
  • 15% rate: Taxable income from $96,701 to approximately $600,050
  • 20% rate: Taxable income above $600,050

High-income taxpayers should also be aware of the Net Investment Income Tax (NIIT), an additional 3.8% surtax on investment income for individuals with modified adjusted gross income above $200,000 (single) or $250,000 (married filing jointly). This means the effective maximum long-term rate can reach 23.8%, and the maximum short-term rate can reach 40.8%.

Short-Term Capital Gains Tax Rates

Short-term capital gains do not receive any preferential treatment. They are added to your ordinary income and taxed at your marginal tax rate. For 2026, the federal ordinary income brackets are:

2026 Federal Income Tax Brackets (Single Filers)

  • 10%: Up to $11,925
  • 12%: $11,926 to $48,475
  • 22%: $48,476 to $103,350
  • 24%: $103,351 to $197,300
  • 32%: $197,301 to $250,525
  • 35%: $250,526 to $626,350
  • 37%: Over $626,350

Because short-term gains stack on top of your other income, a large short-term gain can push you into a higher bracket. For example, if your salary puts you at the top of the 22% bracket, a $20,000 short-term stock gain would be partially taxed at 24%.

How to Calculate Your Capital Gain

The formula for calculating a capital gain is straightforward:

Capital Gain Formula

Capital Gain = Sale Price - Cost Basis

Where Cost Basis = Purchase Price + Purchase Fees + Improvements (for real estate) - Depreciation

Let us walk through a detailed example:

Stock Example: You purchased 100 shares of a company at $50 per share in January 2024, paying a $10 commission. Your cost basis is (100 x $50) + $10 = $5,010. In March 2026, you sell all 100 shares at $80 per share, netting $7,990 after a $10 commission. Your capital gain is $7,990 - $5,010 = $2,980. Since you held the shares for more than one year, this qualifies as a long-term capital gain.

Real Estate Example: You bought a rental property for $250,000 in 2020. Over the years, you spent $30,000 on capital improvements (new roof, renovated kitchen) and claimed $25,000 in depreciation. Your adjusted cost basis is $250,000 + $30,000 - $25,000 = $255,000. You sell the property for $350,000 in 2026, with $15,000 in closing costs. Your net sale price is $335,000, so your capital gain is $335,000 - $255,000 = $80,000.

Understanding Cost Basis Methods

When you purchase shares of the same stock at different times and prices, your cost basis method determines which shares you are considered to have sold. This can significantly affect your tax bill.

  • FIFO (First In, First Out): The default method. The oldest shares are considered sold first. In a rising market, this typically results in higher gains because your earliest (cheapest) shares are sold first.
  • Specific Identification: You choose exactly which shares to sell. This gives you the most control. You might select shares with the highest cost basis to minimize your gain, or pick shares held longer than a year to qualify for long-term rates.
  • Average Cost: Common for mutual funds. Your cost basis is the average price of all shares purchased. This is simpler but offers less tax optimization.

Cost Basis Example

Suppose you bought 50 shares at $40 in 2024 and another 50 shares at $70 in 2025. You now sell 50 shares at $80.

  • FIFO method: Gain = ($80 - $40) x 50 = $2,000 (long-term)
  • Specific ID (selling the $70 shares): Gain = ($80 - $70) x 50 = $500 (short-term)

With FIFO you owe tax on $2,000 at the lower long-term rate. With specific identification you owe on just $500 but at the higher short-term rate. The best choice depends on your income level and overall tax situation.

The Home Sale Exclusion

One of the most valuable tax breaks available to homeowners is the primary residence exclusion under IRS Section 121. If you sell your primary home, you can exclude up to $250,000 in capital gains from your taxable income as a single filer, or up to $500,000 as a married couple filing jointly.

To qualify, you must meet the ownership and use tests: you must have owned and lived in the home as your primary residence for at least two of the five years before the sale. You can use this exclusion once every two years.

Home Sale Exclusion Example

A married couple bought their home in 2020 for $350,000 and sells it in 2026 for $700,000. Their capital gain is $350,000. Because they meet the ownership and use requirements and file jointly, the entire $350,000 gain is excluded from taxation. They owe $0 in capital gains tax on the sale.

If the gain exceeded $500,000, only the amount above $500,000 would be taxable at long-term capital gains rates.

Using Capital Losses to Offset Gains

Capital losses are the silver lining of a bad investment. When you sell an asset at a loss, you can use that loss to offset capital gains dollar-for-dollar. If your total losses exceed your total gains, you can deduct up to $3,000 per year ($1,500 if married filing separately) against your ordinary income. Any remaining losses carry forward to future tax years indefinitely.

The netting process follows a specific order:

  1. Short-term gains are offset by short-term losses first
  2. Long-term gains are offset by long-term losses first
  3. Any remaining net short-term loss offsets net long-term gains, and vice versa
  4. Up to $3,000 of excess net loss offsets ordinary income

Be aware of the wash sale rule: if you sell a security at a loss and repurchase the same or a substantially identical security within 30 days before or after the sale, the loss is disallowed for tax purposes. The disallowed loss gets added to the cost basis of the replacement shares instead.

Strategies to Minimize Capital Gains Tax

There are several legal strategies that can help reduce your capital gains tax liability:

1. Hold investments for more than one year. This is the simplest and most impactful strategy. The difference between short-term and long-term rates can save you 10 to 20 percentage points on every dollar of gain.

2. Tax-loss harvesting. Strategically sell losing investments to generate losses that offset your gains. Many robo-advisors and brokerages now offer automated tax-loss harvesting.

3. Use tax-advantaged accounts. Maximize contributions to 401(k)s, IRAs, and HSAs. Investments within these accounts grow tax-free or tax-deferred, meaning no capital gains tax on trades inside the account.

4. Gift appreciated assets. If you gift stock to a family member in a lower tax bracket, they may pay less capital gains tax when they sell. You can gift up to $19,000 per person per year (2026) without filing a gift tax return.

5. Donate appreciated assets to charity. If you donate stock that has increased in value to a qualified charity, you avoid capital gains tax entirely and can deduct the full market value as a charitable contribution (subject to AGI limits).

6. Harvest gains in low-income years. If you have a year with lower income, such as during retirement, a sabbatical, or a career transition, consider selling appreciated assets while you fall within the 0% long-term capital gains bracket.

7. Consider Qualified Opportunity Zone investments. Reinvesting capital gains into a Qualified Opportunity Zone Fund can defer and potentially reduce capital gains taxes, with gains on the new investment being tax-free if held for at least 10 years.

State Capital Gains Taxes

Do not forget about state taxes. Most states tax capital gains as ordinary income, adding anywhere from 0% to 13.3% on top of the federal rate. Nine states have no income tax: Alaska, Florida, Nevada, New Hampshire (limited), South Dakota, Tennessee, Texas, Washington, and Wyoming. If you live in a high-tax state like California or New York, the combined federal and state rate on short-term gains can exceed 50%.

Calculate Your Tax

📊

Income Tax Calculator

Estimate your tax liability including capital gains with our free calculator.

Calculate Now

More Useful Tools

The Bottom Line

Capital gains tax does not have to be a mystery or a source of anxiety. The key takeaway is that the length of time you hold an asset has a massive impact on how much tax you pay. Short-term gains are taxed at your ordinary income rate (up to 37%), while long-term gains benefit from preferential rates of 0%, 15%, or 20%. By understanding your cost basis, taking advantage of the home sale exclusion, using tax-loss harvesting, and timing your sales strategically, you can keep more of your investment profits. Always consider both federal and state taxes when planning, and consult a qualified tax professional for advice tailored to your specific situation.