How Capital Gains Tax Works

A capital gain occurs when an asset is sold for more than its cost basis. Cost basis generally includes the purchase price plus adjustments such as commissions, fees, reinvested dividends, and certain improvements.

Capital gains are classified as either short-term (held one year or less) or long-term (held more than one year). The holding period is measured from the day after the asset is acquired through the day it is sold. This distinction matters because short-term gains are taxed at ordinary income rates (10%–37%), while long-term gains receive preferential rates (0%, 15%, or 20%).

You only owe capital gains tax when you realize a gain by selling the asset. Unrealized gains (paper profits on assets you still hold) are not taxed.

2026 Federal Capital Gains Tax Rates

Long-Term Capital Gains Rates

Long-term capital gains are taxed at preferential federal rates that depend on your taxable income and filing status:

RateSingleMarried Filing JointlyHead of Household
0%Up to $49,450Up to $98,900Up to $66,200
15%$49,451 – $545,500$98,901 – $613,700$66,201 – $579,600
20%Over $545,500Over $613,700Over $579,600

Short-Term Capital Gains Rates

Short-term capital gains are taxed as ordinary income. The 2026 federal income tax brackets range from 10% to 37%, depending on your total taxable income and filing status.

Net Investment Income Tax (NIIT)

An additional 3.8% Net Investment Income Tax may apply when modified adjusted gross income exceeds $200,000 for single filers or $250,000 for married filing jointly. The tax applies to the lesser of net investment income or the amount by which income exceeds the threshold. While Capital Gains Tax Brackets have been adjusted for inflation, the NIIT thresholds have not been adjusted for inflation.

IRS Circular 230 Disclosure:
This calculator provides estimates for informational purposes only and does not constitute tax, legal, or financial advice. Results may not reflect your actual tax liability. Consult a qualified tax professional before making financial decisions.

State and Local Capital Gains Taxes

Most states tax capital gains as ordinary income. State tax rates vary widely, from 0% in states like Texas, Florida, and Nevada to potentially over 13% in California for high earners. This calculator uses full progressive bracket data for all 50 states and applies bracket stacking to estimate the marginal state tax impact of the gain. While efforts have been made to source accurate tax information, the income brackets were current as of March 15, 2026, and are based on information believed to be accurate but not guaranteed, and may not account for all local and regional taxes, as some tax rates vary, and there is limited publicly available information.

Eight states have no broad income tax: Alaska, Florida, Nevada, New Hampshire, South Dakota, Tennessee, Texas, and Wyoming. New Hampshire historically taxed interest and dividend income but fully repealed that tax effective January 1, 2025; capital gains were never subject to it. Washington has no income tax but imposes a separate capital gains excise tax of 7% (9.9% above $1 million) on long-term gains above the last published official deduction of $278,000 for tax year 2025, subject to additional limitations and exclusions. Washington DOR has not yet published a separate 2026 deduction amount.

Some states apply special rules to capital gains. Massachusetts taxes short-term gains at 8.58% for income under approximately $1 million per year, with income exceeding this amount subject to an additional 4% surcharge. South Carolina, Wisconsin, and several other states offer partial exclusions for long-term gains. Hawaii provides an alternative 7.25% rate, as it taxes capital gains at the lesser of the ordinary income or marginal income rates.

Several cities and counties impose their own income taxes that also apply to capital gains. The calculator is designed to incorporate local income taxes for more than 145 jurisdictions where capital gains are taxed through local income tax systems and where information is prominently available, including:

  • New York City: progressive rates up to 3.876% on top of New York State tax
  • Yonkers, NY: a surcharge of 16.75% of your state tax liability
  • Maryland counties: local income tax rates ranging from approximately 2.25% to 3.3%
  • Michigan cities: 24 cities levy a local income tax on capital gains—Detroit at 2.4% for residents (1.2% nonresidents), Grand Rapids and Saginaw at 1.5% (0.75%), Highland Park at 2% (1%), and most other cities at 1% (0.5%)
  • Portland, OR: Metro Supportive Housing Services tax (1% above $128K/$205K MFJ) plus Multnomah County Preschool for All tax (1.5%–3%), combined up to 4% for high earners

Capital Gains Tax by Asset Type

Stocks and ETFs

When you sell stocks or ETFs at a profit, the gain is taxed as either a short-term or long-term capital gain depending on how long you held the shares. Your cost basis includes the purchase price plus any commissions or fees. If you received shares through an employer stock plan, your cost basis may include compensation income already reported.

Cryptocurrency

The IRS treats qualifying cryptocurrency as property. Selling, trading, or spending crypto triggers a taxable event. The same short-term and long-term capital gains rules apply as with stocks. Each transaction must be tracked individually to determine your cost basis and holding period. Cost basis tracking, wash sale rule treatment for digital assets, and staking/mining income have unique and evolving tax treatment. Additionally, because some cryptocurrencies have historically qualified as securities, there is further ambiguity regarding their tax treatment.

Primary Residence

If you sell your primary residence, you may exclude up to $250,000 of gain ($500,000 for married filing jointly) under the Section 121 exclusion, provided you owned and lived in the home for at least 2 of the last 5 years. Any gain above the exclusion is taxed at capital gains rates.

Rental and Investment Property

When selling rental or investment property held for more than one year, your gain is divided into two components. First, any depreciation previously claimed on the structure is subject to unrecaptured Section 1250 recapture, taxed at a maximum federal rate of 25%. If you claimed depreciation on personal property components (appliances, fixtures, land improvements) through cost segregation or otherwise, that Section 1245 recapture is taxed at ordinary income rates up to 37%. The remaining gain above your original cost basis is taxed at standard long-term capital gains rates (0%, 15%, or 20%, depending on income). The 3.8% Net Investment Income Tax may also apply if your MAGI exceeds $200,000 (single) or $250,000 (married filing jointly).

Some investors use 1031 like-kind exchanges to defer taxes by reinvesting proceeds into qualifying replacement real property. To qualify, you must meet specific requirements, including identifying a replacement property within 45 days and closing within 180 days. Any cash or non-qualifying property received (boot) is taxable.

Important: This calculator assumes you hold the property as a passive investor, not as a real estate dealer. If buying and selling real estate is your primary business activity, the IRS may classify you as a dealer, in which case gains are taxed as ordinary income (not capital gains), 1031 exchanges are generally unavailable, and self-employment tax may apply. Consult a tax professional if you are an active real estate investor with frequent transactions.

Collectibles

Long-term gains on collectibles — including art, antiques, coins, stamps, gems, jewelry, wine, and physical precious metals — are taxed at a maximum federal rate of 28% under IRC §1(h)(4). However, if your marginal income tax rate is below 28%, you pay your marginal rate, not 28%. The 3.8% Net Investment Income Tax may also apply to high-income taxpayers, resulting in a combined federal rate of up to 31.8%. Short-term collectibles gains are taxed at ordinary income rates.

Strategies to Manage Capital Gains Taxes

  • Hold for more than one year. Long-term capital gains rates (0%, 15%, or 20%) are significantly lower than short-term rates (up to 37%).
  • Harvest tax losses. Selling investments at a loss can offset capital gains dollar-for-dollar. Up to $3,000 in net losses can offset ordinary income per year, with excess carried forward.
  • Spread sales across tax years. Selling portions of a large position over multiple years can keep you in lower tax brackets and avoid triggering the NIIT.
  • Donate appreciated assets. Donating appreciated investments directly to charity avoids capital gains tax entirely while providing a fair-market-value deduction.
  • Use tax-advantaged accounts. Holding investments in IRAs or 401(k)s defers or eliminates capital gains taxes on trades within the account.
  • Evaluate tax-aware diversification strategies. Investors with large appreciated stock positions sometimes explore approaches that allow diversification without immediately realizing capital gains. Exchange funds are one example.

Capital Gains Tax Examples

These examples reflect scenarios that are common among tech employees and investors with concentrated stock positions, the situations where capital gains tax planning matters most.

Example 1: Selling Vested RSUs (Single Filer, California)

Scenario: A senior engineer earns $220,000 in base salary. Over the past 4 years, her company RSUs have vested and appreciated significantly. She sells $400,000 worth of shares with a cost basis of $150,000, realizing a $250,000 long-term capital gain. Filing single in San Francisco, CA.

LayerHow it’s calculatedTax
Federal LTCG$220K salary fills ordinary brackets first. The $250K gain stacks on top, falling entirely within the 15% LTCG bracket (up to $545,500 for single filers).$37,500
NIITTotal income is $470,000, exceeding the $200K single threshold by $270K. NIIT is 3.8% on the lesser of net investment income ($250K) or excess ($270K).$9,500
CaliforniaCA taxes capital gains as ordinary income. The $250K gain stacks on top of $220K salary, pushing through the 9.3%, 10.3%, and 11.3% brackets.$24,478
Estimated total tax on the $250K gain$71,478

Effective combined rate: 28.6%. Over $71K in taxes on a $250K gain, and that’s with the preferential long-term rate. This is why many tech employees with large RSU positions explore tax-deferred diversification strategies before selling outright.

Example 2: Large Concentrated Position (MFJ, Washington State)

Scenario: A couple has $350,000 in combined salary. One spouse holds a $1.5M position in a single tech stock, acquired at a cost basis of $200,000 over years of RSU vests. They sell the entire position, realizing a $1.3M long-term gain. Filing MFJ in Seattle, WA.

LayerHow it’s calculatedTax
Federal LTCG$350K salary fills ordinary brackets. The $1.3M gain stacks on top: $263,700 at 15% (filling up to the $613,700 MFJ threshold), then $1,036,300 at 20%.$246,815
NIITTotal income is $1.65M, exceeding the $250K MFJ threshold. NIIT is 3.8% on the full $1.3M of net investment income (lesser of $1.3M NII or $1.4M excess).$49,400
WashingtonWA imposes a capital gains excise tax on long-term gains. After the $278K standard deduction (2025 figure, indexed annually), $1,022,000 is taxable: the first $1M at 7% ($70,000) and the remaining $22K at 9.9% ($2,178).$72,178
Estimated total tax on the $1.3M gain$368,393

Effective combined rate: 28.3%. Over $368K goes to taxes on a single sale. For positions this large, selling outright is often the most expensive option. Strategies like exchange funds (where you contribute appreciated shares into a diversified fund alongside other investors) can defer these taxes entirely while achieving diversification.

Example 3: Home Sale with Section 121 Exclusion (MFJ, New York City)

Scenario: A dual-income tech couple with $400,000 in combined salary sells their Brooklyn apartment for a $750,000 gain after living there for 6 years. Filing MFJ in New York City.

LayerHow it’s calculatedTax
Section 121 exclusionMFJ filers who owned and lived in the home 2 of the last 5 years exclude up to $500K. Taxable gain: $750,000 − $500,000 = $250,000.
Federal LTCG$400K salary fills ordinary brackets. The $250K gain stacks starting at $400K: $213,700 falls in the 15% bracket (up to $613,700 MFJ) and $36,300 spills into the 20% bracket.$39,315
NIITTotal income is $650,000, exceeding the $250K MFJ threshold by $400K. NIIT is 3.8% on the lesser of net investment income ($250K) or the excess ($400K).$9,500
New York StateThe $250K gain stacks on top of $400K salary through NY’s progressive brackets. At this income level, the marginal rate is 6.85%.$17,125
New York CityNYC residents pay an additional progressive city income tax. At this income level, the marginal rate is 3.876%.$9,690
Estimated total tax on the $250K taxable gain$75,630

Effective combined rate on the taxable portion: 30.3%. The Section 121 exclusion saved this couple roughly $173K in taxes by sheltering the first $500K. Without it, the full $750K gain would push deep into higher brackets across all four tax layers.

These examples are for illustrative purposes only and do not represent a guarantee or prediction of actual tax liability. Tax calculations depend on individual circumstances including total income, deductions, filing status, asset-specific rules, and current tax law, which is subject to change. These examples use estimated 2026 federal brackets and current state rates as of the date of publication, and do not account for alternative minimum tax, state-specific deductions, passive activity rules, or other factors that may affect your specific situation. Consult a qualified tax professional before making any financial or tax planning decisions.

Alternatives to Selling Concentrated Stock

For investors holding large appreciated positions in a single stock (common among tech employees with vested RSUs), selling outright often means giving up 25–35% of the gain to taxes. Several strategies can help defer or reduce this cost while achieving diversification:

  • Exchange funds pool concentrated stock from multiple investors into a diversified fund. The contribution qualifies as a tax-deferred event under IRC Section 721. You receive fund shares representing ownership of a diversified portfolio (benchmarked to indexes like the S&P 500 or Nasdaq-100) without triggering capital gains. After a required seven-year holding period, you can redeem diversified shares with the original cost basis intact.
  • Tax-aware long/short strategies enhance tax-loss harvesting by extending a traditional long-only portfolio into a long/short structure. A 130/30 strategy invests 130% long and 30% short, aiming to achieve a net market exposure at 100%. Two advantages over standard direct indexing: more capital at work to harvest losses from the extra gross exposure, and short positions that could generate losses in rising markets. The result is a strategy that harvests losses in virtually all market environments, offsetting the gains you realize as you gradually sell down your concentrated position.
  • Collar advances provide a way to access liquidity from an appreciated stock position without selling it. The underlying structure uses a protective collar with a floor and cap price, providing a fixed rate for the full term (typically 1–5 years) at rates much lower than margin loans or mortgages, and no margin calls.

These approaches were historically available only to ultra-high-net-worth investors through private banks. Cache makes exchange funds, long/short strategies, and collar advances accessible to a broader range of investors with concentrated stock positions. Assets are custodied at battle-tested providers, with full SIPC protection.

Explore tax-deferred diversification strategies →

Methodology & Sources

This calculator uses 2026 federal tax brackets and long-term capital gains thresholds from IRS Revenue Procedure 2025-32. Calculations follow the structure of the IRS capital gain tax worksheet used in Schedule D. State taxes are calculated using full progressive bracket data for all 50 states plus D.C., with bracket stacking applied the same way as at the federal level. Local tax data covers 145+ jurisdictions and is based on information believed to be reliable but not guaranteed, and does not account for all municipalities.

The engine handles bracket stacking (your ordinary income fills brackets first, then capital gains stack on top), Net Investment Income Tax calculations, Section 121 home sale exclusions, Section 1250 depreciation recapture, collectibles rates (28% max), capital loss netting, and state-specific rules including Washington’s excise tax, Massachusetts short-term rates, and multi-state long-term gain exclusions.

Limitations: This calculator does not account for:

  • Alternative Minimum Tax (AMT)
  • Wash sale rules
  • Qualified Small Business Stock (Section 1202)
  • Installment sales or 1031 exchanges
  • Multiple tax lots
  • Qualified Opportunity Zones
  • State-specific deductions or credits
  • Complex partnership, trust structures, or entities
  • State and local brackets and deductions

State and local tax data is updated for 2026 but may not reflect mid-year legislative changes.

Last updated: March 2026. Tax rules and thresholds are subject to change.