Capital Gains Tax Calculator
Your details
Advanced options
Result
Capital gains tax owed
- You keep
- $67,625
- Taxable gain
- $32,500
- Effective rate on the gain
- 15.00%
- Cost basis
- $42,500
- Federal tax
- $4,875
- Long-term treatment applies, taxing the gain at 15% instead of your 24% income rate — a saving of $2,925 against a short-term sale.
- The $2,500 of purchase and selling costs raised your basis and cut the taxable gain by the same amount, saving $375 in tax. These are the most commonly missed deduction on an asset sale.
Short-term versus long-term on this gain
The same sale under both treatments. The only difference is whether you held it more than one year.
| Treatment | Federal rate | Federal tax | Total tax |
|---|---|---|---|
| Short-term (1 year or less) | 24% | $7,800 | $7,800 |
| Long-term (over 1 year) | 15% | $4,875 | $4,875 |
Long-term capital gains rates
Which band you fall in depends on taxable income and filing status, and the thresholds are indexed annually — check the current IRS table.
| Rate | Applies to | Tax on this gain |
|---|---|---|
| 0% | lower income band | $0 |
| 15% | most taxpayers | $4,875 |
| 20% | highest income band | $6,500 |
How is capital gains tax calculated?
Capital gains tax is calculated on the sale price minus your cost basis, which is the purchase price plus buying and selling costs. Assets held more than one year are taxed at 0%, 15% or 20%; those held a year or less are taxed as ordinary income.
gain = sale price − (purchase price + costs) tax = gain × rate- costs
- Commissions, fees and capital improvements — all add to basis
- rate
- 0/15/20% if held over a year, otherwise your ordinary income rate
The arithmetic is a subtraction and a multiplication; the money is in the two inputs. Cost basis is the first. It is not just what you paid — commissions, transfer taxes, legal fees and, for property, capital improvements all add to it, and every dollar of basis is a dollar removed from the taxable gain. Forgetting them is the most common and most expensive error on an asset sale. The holding period is the second and larger lever. One year and one day qualifies the gain for long-term treatment at 0%, 15% or 20%; a day less and the whole gain is taxed as ordinary income, which for most people is a 22% to 37% rate. On a $32,500 gain that difference is several thousand dollars for the sake of a few days. Two additions sit on top: most states tax gains as ordinary income, and a 3.8% net investment income tax applies above a statutory threshold that is not indexed for inflation.
- Add purchase costs and improvements to the purchase price for your basis.
- Subtract that basis from the sale price to get the gain.
- Subtract any realised capital losses from the same tax year.
- Apply the long-term rate if you held it over a year.
- Otherwise apply your ordinary income tax rate.
- Add state tax and the 3.8% surtax where they apply.
Worked example: Shares bought for $40,000 with $2,500 of costs, sold for $75,000 after two years, 15% long-term rate
Shares bought for $40,000 with $2,500 of costs, sold for $75,000 after two years, 15% long-term rate
The cost basis is the $40,000 purchase price plus $2,500 of commissions and fees, so $42,500. Subtracting that from the $75,000 sale price gives a taxable gain of $32,500 — not the $35,000 a simple sale-minus-purchase calculation would suggest, which is why basis matters. Held for two years, the gain qualifies for long-term treatment at 15%, so the federal tax is $4,875 and you keep $67,625 of the proceeds. Had the same shares been sold at eleven months instead, the whole $32,500 would be taxed as ordinary income at 24%, which is $7,800 — $2,925 more for selling a few weeks early. The $2,500 of costs saved $375 in tax on their own. Add a 5% state tax and the bill rises by $1,625; add the 3.8% surtax and by a further $1,235.
What each capital gains tax input means
- Sale price
- What you sold the asset for, before any selling costs.
- Purchase price
- What you originally paid. For inherited assets this is usually the value at the date of death, not what the deceased paid.
- Purchase and selling costs
- Commissions, transfer taxes, legal fees and — for property — capital improvements. These add to your basis and reduce the taxable gain, and they are the most commonly forgotten deduction.
- How long did you hold it?
- The single most consequential input. More than one year qualifies for long-term rates, which are substantially lower. The clock runs from the day after acquisition to the day of sale.
- Your long-term rate
- Long-term gains are taxed at 0%, 15% or 20% depending on your taxable income and filing status. The thresholds are indexed every year — check the current IRS table linked below rather than assuming last year's figures.
- Your marginal income tax rate
- Used for short-term gains, which are taxed as ordinary income rather than at capital-gains rates.
- State tax rate on gains
- Most states tax capital gains as ordinary income; nine have no income tax at all. Enter your state's rate, or zero if it does not tax gains.
- Capital losses to offset
- Realised losses from other sales in the same year. Losses offset gains directly, which is the basis of tax-loss harvesting.
- Net investment income tax applies
- An additional 3.8% on investment income above a statutory modified adjusted gross income threshold. Unlike the capital gains brackets, that threshold is not indexed for inflation.
What this capital gains tax does not account for
- Long-term rate bands depend on taxable income and filing status, and the thresholds are indexed every year. This calculator takes the rate as an input rather than guessing your bracket — check the current IRS table.
- The holding period runs from the day after acquisition to the day of sale, and must exceed one year. One year exactly is still short-term.
- Inherited assets normally receive a stepped-up basis at the date of death, so the gain is measured from that value rather than what the deceased paid. Gifted assets usually carry the giver's basis instead.
- A primary residence may qualify for an exclusion of gain on sale, subject to ownership and use tests. That exclusion is not modelled here and changes the answer substantially.
- Collectibles and certain real-estate depreciation recapture are taxed at higher maximum rates than the 0/15/20 bands.
- The wash-sale rule disallows a loss if you buy a substantially identical security within 30 days either side of the sale. Losses entered here are assumed to be allowable.
- Capital losses offset gains in full, and up to $3,000 of ordinary income a year, with the remainder carried forward indefinitely.
Frequently asked questions
What is the capital gains tax rate?
Long-term gains on assets held over a year are taxed at 0%, 15% or 20% depending on taxable income and filing status. Short-term gains are taxed as ordinary income, which for most people is 22% to 37%.
How long do I have to hold an asset for long-term treatment?
More than one year — one year and one day. The clock starts the day after you acquire it and ends on the day you sell. Exactly one year still counts as short-term.
What counts toward my cost basis?
The purchase price plus commissions, transfer taxes, legal fees and, for property, capital improvements. Every dollar of basis reduces the taxable gain by a dollar, and these are the most commonly missed deductions.
Can capital losses offset capital gains?
Yes, in full. Losses beyond your gains can offset up to $3,000 of ordinary income a year, with the rest carried forward indefinitely. Deliberately realising losses to do this is called tax-loss harvesting.
Do I pay state tax on capital gains?
In most states, yes, usually as ordinary income rather than at a preferential rate. Nine states have no income tax at all, so gains there are federally taxed only.
What is the net investment income tax?
An additional 3.8% on investment income above a statutory modified adjusted gross income threshold. Because that threshold is not indexed for inflation, it reaches more taxpayers every year.
Sources and review
“To correctly arrive at your net capital gain or loss, capital gains and losses are classified as long-term or short-term.”
Topic no. 409, Capital gains and losses — Internal Revenue Service- Questions and answers on the net investment income tax — Internal Revenue Service
Last reviewed .