How the capital gains tax calculator works
A capital gain is the sale price minus your cost basis. How it is taxed depends on how long you held the asset.
Long-term (held over a year), 2026: 0% up to $49,450 taxable income single ($98,900 joint), 15% up to $545,500 ($613,700), 20% above
Short-term: taxed at ordinary income tax rates
The gain is stacked on top of your other taxable income, so part of a large gain can fall in a higher bracket than the rest. The 3.8% net investment income tax applies to the smaller of the gain or the amount your income exceeds $200,000 single or $250,000 joint (a simplification that treats taxable income as modified AGI). Special rates for collectibles (28%) and depreciation recapture on real estate (25%) are not modelled, nor are home-sale exclusions or state tax.
Holding period: the one-day difference
To get long-term rates, you must hold an asset for more than one year. The count starts the day after you buy and includes the day you sell. Selling a day too early can turn a 15% tax into an ordinary-income tax, as the worked example shows ($3,000 vs $4,400). If a sale is close to the one-year mark, check the dates on your brokerage statement first.
Using losses
Capital losses offset capital gains. If losses exceed gains, up to $3,000 of the net loss a year ($1,500 if married filing separately) can offset ordinary income, and the rest carries forward to future years. Selling losing positions to capture this, called tax-loss harvesting, is common near year-end.
Watch the wash-sale rule: if you buy the same or a substantially identical security within 30 days before or after the sale, the loss is disallowed for now and added to the basis of the new shares.
Selling your home
If you owned and lived in a home as your main residence for at least two of the five years before the sale, you can usually exclude up to $250,000 of gain ($500,000 for married couples filing jointly). Gains above that, or on a second home or rental, are taxable, and depreciation taken on a rental is taxed separately.
Getting your basis right
- Include purchase commissions and fees in your cost basis.
- Reinvested dividends add to basis; forgetting them means paying tax twice.
- Inherited assets generally get a "stepped-up" basis equal to the value at the date of death.
- Gifted assets usually keep the giver's original basis.
Sources
- IRS Topic No. 409, Capital Gains and Losses, and Publication 550, Investment Income and Expenses.
- IRS Publication 523, Selling Your Home.
Worked example
A single filer with $60,000 of other taxable income sells shares bought for $10,000 for $30,000, a $20,000 gain. Held over a year, the whole gain is above the 0% threshold and is taxed at 15%: $3,000. Sold within a year, it would be taxed as ordinary income in the 22% bracket: $4,400.
Tax estimates use 2026 federal figures and simplified rules. They are not tax advice; check with a tax professional.
Frequently asked questions
What are the 2026 long-term capital gains brackets?
0% up to $49,450 of taxable income for single filers ($98,900 joint), 15% up to $545,500 ($613,700 joint), and 20% above that.
How are short-term capital gains taxed?
As ordinary income at your regular tax bracket.
What is cost basis?
Usually what you paid for the asset plus purchase fees, adjusted for things like reinvested dividends or home improvements.
Is there tax on selling a home?
Up to $250,000 of gain ($500,000 joint) on a main home can be excluded if you meet the ownership and use tests.