What Is a Capital Gain?
A capital gain is the profit you realize when you sell a capital asset — a stock, mutual fund, bond, real estate, or other investment — for more than you originally paid. The difference between your sale proceeds and your cost basis (what you paid, including commissions and fees) is the taxable gain.
If you sell for less than you paid, you have a capital loss. Losses can offset gains dollar for dollar, and up to $3,000 in net losses can be deducted against ordinary income each year; excess losses carry forward to future tax years.
Capital gains are only taxed when you sell. An investment that doubles in value while you hold it creates no immediate tax liability. This is why the holding period matters so much: by holding an asset long enough to qualify for long-term treatment, many investors can cut their tax rate by more than half.
Short-Term vs. Long-Term: The Holding-Period Dividing Line
The single most important factor in capital gains taxation is the holding period — how long you owned the asset before selling.
Short-term capital gains apply to assets sold after holding them 365 days or fewer. These gains are taxed as ordinary income, using the same federal income tax brackets as wages and salaries. Depending on your total income, the effective rate on a short-term gain can be 10%, 12%, 22%, 24%, 32%, 35%, or 37%.
Long-term capital gains apply to assets held more than 365 days (at least one year and one day). These gains qualify for preferential federal rates: 0%, 15%, or 20%, depending on your taxable income and filing status. For most middle-income investors, the long-term rate is 15%.
The practical implication is significant. On a $30,000 gain, a single filer with $60,000 in ordinary income would owe $6,600 in federal tax if the asset was held short-term (22% bracket) but only $4,500 if held long-term (15% bracket). That $2,100 difference is simply the result of waiting.
Federal Long-Term Capital Gains Rates for 2026
Long-term capital gains rates for 2026 are set at three tiers, based on total taxable income (ordinary income plus long-term gains), not just the gain itself.
| Filing Status | 0% Rate Up To | 15% Rate Up To | 20% Rate Above |
|---|---|---|---|
| Single | ~$47,025 | ~$518,900 | >$518,900 |
| Married Filing Jointly | ~$94,050 | ~$583,750 | >$583,750 |
| Head of Household | ~$63,000 | ~$551,350 | >$551,350 |
These thresholds are inflation-adjusted annually. The key insight: the rate depends on where your total income (including the gain) lands, not just your ordinary income alone. If your ordinary income is $60,000 and you realize a $30,000 long-term gain, total income is $90,000 — placing the gain in the 15% bracket for a single filer.
The Net Investment Income Tax (NIIT)
High-income taxpayers face an additional 3.8% federal surtax on net investment income — the Net Investment Income Tax enacted under the Affordable Care Act. The NIIT applies when modified adjusted gross income (MAGI) exceeds:
- $200,000 for single filers, heads of household, and married filing separately
- $250,000 for married filing jointly
The surtax applies to the lesser of (a) your net investment income or (b) the amount by which your MAGI exceeds the threshold. Both short-term and long-term gains are included in net investment income.
For a single filer with $150,000 in ordinary income selling a long-term investment for a $200,000 gain, total MAGI is $350,000. The NIIT applies to the lesser of $200,000 (the gain) and $150,000 ($350,000 − $200,000 threshold). On $150,000, the NIIT is $5,700. Combined with the 15% capital gains tax on the full $200,000 gain ($30,000), the total federal bill is $35,700.
When the NIIT applies, the effective maximum federal rate on long-term gains is 23.8% (20% + 3.8%).
How to Calculate Your Capital Gains Tax: A Worked Example
A single filer earns $60,000 in wages during 2026. In December, they sell shares of stock they purchased years ago:
- Sale proceeds: $50,000
- Cost basis (what they paid): $20,000
- Holding period: More than one year (long-term)
Step 1: Calculate the taxable gain.
Taxable gain = $50,000 − $20,000 = $30,000
Step 2: Determine the applicable long-term rate.
Total income = $60,000 ordinary income + $30,000 long-term gain = $90,000. For a single filer, the 15% LTCG bracket covers income from approximately $47,025 to $518,900. At $90,000 total income, the 15% rate applies.
Step 3: Compute the capital gains tax.
Capital gains tax = $30,000 × 15% = $4,500
Step 4: Check for NIIT.
MAGI = $60,000 + $30,000 = $90,000. The single-filer NIIT threshold is $200,000. At $90,000 MAGI, the NIIT does not apply.
Total federal capital gains tax: $4,500. Net proceeds after federal tax: $45,500.
For comparison, if this investor had sold after holding the shares for only eight months, the $30,000 short-term gain would be taxed at the 22% ordinary-income bracket rate (since $90,000 falls in the 22% bracket for 2026). That would produce a tax bill of $6,600 — $2,100 more than the long-term scenario.
What Counts as Cost Basis?
Your cost basis is the starting point for computing the gain, and it is not always simply the purchase price. Common basis adjustments:
Commissions and fees. Brokerage commissions paid when you bought the asset increase your basis (reducing the eventual gain). Most online brokers now charge no trading commissions, but older purchases may have included fees of $5–$25 per trade.
Reinvested dividends. If you reinvest dividends from a mutual fund or stock, each reinvestment creates a new lot with its own basis and holding period. This means a single fund position can contain dozens of tax lots with different per-share bases.
Inherited assets. Assets inherited at death receive a “stepped-up” basis equal to the fair market value on the date of death. This eliminates the capital gain that accrued during the decedent’s lifetime. An heir who immediately sells an inherited stock worth $100,000 (purchased originally for $10,000) generally owes no capital gains tax.
Gifted assets. Assets received as a gift carry over the giver’s original basis. If someone gives you stock with a basis of $5,000 that is now worth $20,000, your basis is $5,000 when you sell.
State Capital Gains Taxes
This calculator estimates federal tax only. Most states also tax capital gains, though the treatment varies:
- No state income tax: Alaska, Florida, Nevada, New Hampshire, South Dakota, Tennessee, Texas, Washington, and Wyoming impose no state capital gains tax.
- Ordinary income rates: Most other states tax capital gains as ordinary income at state income tax rates, which range from under 3% to over 13% (California tops the list at 13.3%).
- Separate preferential rates: A handful of states offer lower rates on long-term gains; specifics depend on your state of residence.
For a complete tax picture, add your state’s capital gains rate to the federal estimate.
Frequently Asked Questions
When do I owe capital gains tax? You owe capital gains tax in the year you sell the asset — specifically, for the tax year in which the sale closes. If you sell on December 28, 2026, the gain appears on your 2026 federal return, due April 15, 2027. Merely having an unrealized gain (a position worth more than you paid) creates no tax obligation until you sell.
Can capital losses offset ordinary income? Capital losses first offset capital gains of the same type (short-term against short-term, long-term against long-term), then cross-offset the net. If losses exceed all gains, up to $3,000 per year may be deducted against ordinary income. Excess losses carry forward to future years without expiration.
Does the holding period reset if I transfer shares to another account? No. Transferring shares between your own accounts (brokerage to IRA, one brokerage to another) does not reset the holding period or change the cost basis. The clock continues from the original purchase date.
Are retirement account gains subject to capital gains tax? No. Gains inside a traditional IRA, 401(k), or similar pre-tax account are not taxed until you take distributions, at which point they are taxed as ordinary income — not at preferential capital gains rates. Roth account gains are generally not taxed at all upon qualified distribution. This tax treatment is one of the major benefits of tax-advantaged accounts.
What is tax-loss harvesting? Tax-loss harvesting is the practice of selling underperforming positions to realize capital losses that offset gains elsewhere in the portfolio. A common year-end strategy, it can reduce your current-year tax bill without meaningfully changing your long-term investment exposure (you typically reinvest in a similar — not identical — position to avoid the “wash sale” rule, which disallows the loss if you buy the same security within 30 days before or after the sale).