United StatesTaxes & Levies

How to Calculate Capital Gains Tax: A Simple Step-by-Step Guide

The formula, the short-term vs. long-term rule and a worked 2026 example, so you know what you will owe before you sell.

By: CalcGeo Editorial TeamVerified by: CalcGeo Review BoardReviewed: October 2026• 11 min read
Key Takeaways & Direct Answer

How do you calculate capital gains tax in 2026?

Capital gains tax is calculated by first determining your net capital gain using the statutory formula: Capital Gain = Selling Price − Adjusted Cost Basis − Eligible Selling Costs. If the asset was held for one year or less, it is a short-term capital gain taxed at ordinary federal income tax rates (10% to 37%). If held for more than one year, it is a long-term capital gain taxed at preferential federal rates of 0%, 15%, or 20% depending on your total taxable income. High earners may also owe an additional 3.8% Net Investment Income Tax (NIIT).

  • Core Formula: Net Capital Gain = Gross Sales Proceeds − Adjusted Cost Basis − Transaction Fees.
  • Short-Term Rates: Assets held 1 year or less are taxed at ordinary income tax brackets (10% to 37%).
  • Long-Term Rates: Assets held over 1 year enjoy preferential brackets: 0% (up to $49,450 taxable income for single), 15% ($49,450 to $545,500), and 20% (over $545,500).
  • Net Investment Income Tax (NIIT): Surtax of 3.8% applies to investment gains when Modified AGI exceeds $200,000 (single) or $250,000 (married filing jointly).
  • Loss Offsetting: Capital losses offset capital gains dollar-for-dollar; up to $3,000 in excess net losses can offset ordinary income each year, with unused losses carried forward indefinitely.

1. What Is a Capital Gain?

Selling an investment at a profit feels rewarding—until you determine what portion the IRS and state taxing authorities will claim.

The answer is rarely a generic "15%." Your true capital gains tax liability depends on your holding period, your total taxable income, your filing status, and your state of residence.

Under IRC § 1221, almost everything you own and use for personal or investment purposes is a capital asset. This includes:

  • Corporate stocks, exchange-traded funds (ETFs), and mutual funds
  • Cryptocurrencies and digital assets (treated as property by the IRS)
  • Real estate (rental properties, land, second homes, and personal residences)
  • Bonds, precious metals, and collectibles
  • Business ownership interests and private equity shares

When you sell a capital asset for more than your adjusted cost basis, you realize a capital gain. If you sell for less than your basis, you incur a capital loss.

2. The Statutory Capital Gain Formula

To calculate your taxable gain, apply the standard IRS formula:

Capital Gain (or Loss) = Gross Selling Price - Adjusted Cost Basis - Eligible Selling Expenses

Where each component is defined as:

  1. 1Gross Selling Price: The total proceeds received from the buyer.
  2. 2Adjusted Cost Basis: The original purchase price plus broker commissions, purchase fees, and capital improvements (for real estate), minus any prior depreciation taken or non-dividend return of capital.
  3. 3Selling Expenses: Brokerage trading commissions, exchange fees, legal fees, title transfer costs, and advertising costs directly incurred to execute the sale.

Important Note: The resulting capital gain is your taxable profit—it is not the amount of tax you owe. The tax liability is determined by applying the appropriate statutory tax rate to that gain.

Legal BasisUnder IRC § 1001, gain from the sale or other disposition of property equals the excess of the amount realized over the adjusted basis provided in section 1011.

3. Short-Term vs. Long-Term Capital Gains

The single most important factor determining your tax rate is your holding period:

  • Short-Term Capital Gains (Held 1 Year or Less):
    • If you acquire an asset and sell it after holding it for one year or less, your profit is treated as ordinary income.
    • Short-term gains are taxed at your ordinary marginal tax brackets: 10%, 12%, 22%, 24%, 32%, 35%, or 37%.
  • Long-Term Capital Gains (Held More Than 1 Year):
    • If you hold an asset for more than 365 calendar days before selling, you qualify for preferential long-term capital gains rates: 0%, 15%, or 20%.
  • Holding Period Clock: The holding period begins the day after you acquire the asset and includes the day you sell it. Holding an asset for exactly one year plus one day triggers the lower long-term rate.

4. 2026 Federal Capital Gains Tax Brackets

Long-term capital gains tax rates are determined by your total taxable income (including ordinary wages, interest, and the capital gain itself):

2026 Federal Long-Term Capital Gains Tax Brackets
Tax RateSingle Filer Taxable IncomeMarried Filing JointlyHead of Household
0.0%Up to $49,450Up to $98,900Up to $66,200
15.0%$49,451 to $545,500$98,901 to $613,700$66,201 to $579,600
20.0%Over $545,500Over $613,700Over $579,600

5. The 3.8% Net Investment Income Tax (NIIT)

Enacted under IRC § 1411, the Net Investment Income Tax (NIIT) imposes an extra 3.8% surtax on investment earnings for higher-income filers:

  • Statutory Thresholds: Applies when Modified Adjusted Gross Income (MAGI) exceeds $200,000 for single filers or $250,000 for married couples filing jointly (thresholds are not indexed for inflation).
  • Tax Calculation: The 3.8% tax applies to the lesser of your net investment income or the amount by which your MAGI exceeds the statutory threshold.
  • Top Effective Capital Gains Rate: For taxpayers in the 20% long-term bracket subject to NIIT, the effective federal capital gains rate is 23.8%.

6. State Capital Gains Tax Rules

State tax treatment of capital gains varies substantially:

  • Taxed as Ordinary Income (No Discount): States like California, New York, and New Jersey offer zero preferential tax rates for long-term investments. In California, capital gains are taxed at ordinary income rates up to 13.3%, creating a combined federal/state rate of up to 37.1%.
  • Zero State Tax: States with no individual income tax—including Texas, Florida, Nevada, Tennessee, and Wyoming—levy 0% state tax on capital gains.
  • Special Capital Gains Taxes: Washington state enforces a 7.0% excise tax on long-term capital gains exceeding $250,000 from the sale of stocks and bonds.

7. Worked Example: $7,900 Stock Profit

Consider an investor who purchased shares for $10,000, paid a $100 broker commission, and sold them for $18,000. The investor is single with $60,000 in taxable wage income:

  1. 1Calculate Net Gain: $18,000 sale proceeds − $10,000 cost basis − $100 commission = $7,900.00 capital gain.
  2. 2Scenario A: Held for 14 Months (Long-Term):
    • Taxable income ($60,000) falls comfortably into the 15% long-term bracket ($49,451 to $545,500).
    • Capital gains tax: $7,900 × 15% = $1,185.00.
  3. 3Scenario B: Held for 8 Months (Short-Term):
    • The $7,900 gain is added to ordinary income and taxed at the 22% marginal federal income tax bracket.
    • Capital gains tax: $7,900 × 22% = $1,738.00.

Tax Savings: Holding the stock for more than one year saved $553.00 in federal taxes (a 31.8% tax reduction).

8. Offsetting Gains with Capital Losses ($3,000 Rule)

The tax code allows you to utilize investment losses to reduce taxable gains through tax-loss harvesting:

  1. 1Netting Process:
    • Short-term losses first offset short-term gains.
    • Long-term losses first offset long-term gains.
    • Any net loss in one category then offsets net gains in the other category.
  2. 2$3,000 Ordinary Income Offset:
    • If your total capital losses exceed your total capital gains for the year, you can deduct up to $3,000 of excess net losses against your ordinary salary or wage income ($1,500 if married filing separately).
  3. 3Indefinite Carryforward:
    • Losses beyond the $3,000 limit do not disappear. They carry forward indefinitely into future tax years to offset future capital gains.
Example with LossIf you have a $7,900 long-term gain and realize a $2,000 long-term loss on another asset, your taxable gain drops to $5,900, reducing your 15% tax from $1,185 to $885.

9. Which Shares Did You Sell? (FIFO vs. Specific ID)

If you accumulated shares of the same stock or index fund at different times and prices (dollar-cost averaging), your tax liability depends on which shares you sell:

  • First-In, First-Out (FIFO): Default brokerage method; sells your oldest shares first. Often triggers larger capital gains because older shares typically have lower cost bases.
  • Specific Identification (Spec ID): Allows you to select exact lots (such as highest-cost shares) to minimize current capital gains or harvest a loss.
  • Consult your brokerage statement and IRS Form 1099-B before placing sell orders.

10. Tax Reporting on Form 8949 & Schedule D

When reporting investment sales on your annual federal return:

  • Form 1099-B: Sent by your brokerage by mid-February detailing gross proceeds and reported cost basis.
  • Form 8949: Used to list every individual transaction, separating short-term sales (Part I) from long-term sales (Part II).
  • Schedule D (Form 1040): Summarizes aggregate net capital gains or losses and calculates the final tax owed.

11. Advanced Tax-Saving Strategies

Legitimate tax strategies to legally minimize capital gains liabilities:

  1. 1Section 121 Primary Residence Exclusion: Exclude up to $250,000 of capital gain ($500,000 for married filing jointly) on the sale of your primary home if you owned and lived in it for at least 2 of the previous 5 years.
  2. 2Step-Up in Basis for Inherited Assets: When you inherit appreciated assets, the cost basis is stepped up to fair market value on the date of the decedent's death, eliminating prior untaxed capital gains.
  3. 3Beware the Wash-Sale Rule: Under IRC § 1091, if you sell a security at a loss and repurchase a substantially identical security within 30 days before or after the sale, your tax loss deduction is disallowed and added to the basis of the new security.

12. Frequently Asked Questions

Review answers to critical questions about capital gains taxes:

Expert Q&A

Frequently Asked Questions

Do I have to pay capital gains tax if I reinvest the proceeds immediately?

Yes, in a standard taxable brokerage account. Reinvesting proceeds into another stock or fund does not defer capital gains taxes. Tax deferral applies only inside tax-advantaged accounts like a 401(k) or IRA, or via a Section 1031 exchange for qualifying real estate.

Is cryptocurrency taxed as a capital gain in the United States?

Yes. The IRS treats cryptocurrency as property under Notice 2014-21. Selling crypto for cash, trading one coin for another, or using crypto to buy goods triggers a taxable capital gain or loss.

What is the 0% long-term capital gains tax rate?

In 2026, single filers with total taxable income up to $49,450 ($98,900 for married couples filing jointly) pay 0.0% federal tax on qualifying long-term capital gains.

How much capital loss can I deduct against my regular salary each year?

You can deduct up to $3,000 of net capital losses against your ordinary salary and wage income per year ($1,500 if married filing separately). Any remaining net loss carries forward into subsequent tax years indefinitely.

Related Calculators & Comparisons

Explore related tools to calculate your numbers: