Taxes
Capital Gains Tax Calculator
Estimate federal and state tax on selling stocks, funds or property, including the 3.8% net investment income tax.
Editorial review in progress · How we review
Uses 2026 figuresYour results will appear here.
Adjust the numbers, then press Calculate.
Assumptions
- 2026 long-term rates: 0% up to $49,450 / $98,900 / $66,200 taxable income (single / joint / head of household), 15% up to $545,500 / $613,700 / $579,600, then 20% (Rev. Proc. 2025-32). NIIT 3.8% above $200,000 / $250,000 MAGI.
- Home sales, collectibles and depreciation recapture have special rules not modeled here.
When you sell an investment for more than you paid, the profit is a capital gain, and how it's taxed depends on how long you held it and your other income. This calculator estimates federal tax, the 3.8% net investment income tax and state tax on a gain, so you can plan a sale or decide when to sell.
What this calculator does
Enter the gain, whether you held the investment more than a year, your other income, filing status and state tax rate. It shows:
- the total tax on the gain,
- the federal capital gains tax,
- the net investment income tax,
- the state tax,
- the effective rate on the gain, and
- how much you keep.
The formula in plain English
Ordinary taxable income = other income − the 2026 standard deduction.
Long-term gains are stacked on top of ordinary taxable income and taxed in these 2026 ranges:
- 0% up to $49,450 single, $98,900 married filing jointly, $66,200 head of household.
- 15% up to $545,500 single, $613,700 joint, $579,600 head of household.
- 20% above those amounts.
Short-term gains are taxed at your ordinary income tax rates.
Net investment income tax = 3.8% × the smaller of the gain and the amount your income (including the gain) is above $200,000 single or $250,000 joint.
State tax = gain × your state rate.
A worked example
Dr. Kim, who is single, sells index fund shares held for several years with a $50,000 gain. Her other income is $200,000, and she pays 5% state tax.
- Her ordinary taxable income is $183,900, already above the 0% range, so the whole gain is taxed at 15%: $7,500.
- Her income plus the gain is $250,000, so the NIIT applies to $50,000: $1,900.
- State tax: $2,500.
- Total: $11,900, an effective rate of about 23.8%.
- She keeps: $38,100.
If she had held the shares for less than a year, the gain would be taxed at her 24%–32% ordinary rate instead, costing thousands more.
Why it matters at each career stage
If you're: Resident / fellow
With lower income in training, long-term gains may fall in the 0% or 15% range. If you have a taxable account, training years can be a good time to realize gains.
If you're: Employed
High earners often pay 15% or 20% plus the 3.8% NIIT. Holding investments more than a year, using tax-advantaged accounts and harvesting losses all help.
If you're: Practice owner
Selling a practice can create a large gain in one year. How the sale is structured, and over how many years it's paid, can change the tax a lot. Plan with a CPA well before a sale.
Ways to lower capital gains tax
Hold more than a year. Long-term rates are much lower than short-term.
Use tax-advantaged accounts. Gains inside 401(k)s, IRAs and HSAs aren't taxed each year.
Harvest losses. Selling investments at a loss can offset gains.
Time sales for lower-income years. A sabbatical, part-time year or early retirement can drop gains into the 0% or 15% range.
Give appreciated shares. Donating shares you've held more than a year avoids the gain and may give you a charitable deduction.
Leave investments to heirs. Heirs usually receive a "step-up" in cost basis, wiping out the gain.
Special cases
Collectibles, depreciation recapture on rental property and some small business stock have special rates or rules. Home sales may qualify for the exclusion. For large or complex sales, talk with a tax professional.
Next, check your marginal tax rate, track your net worth, and compare Roth vs traditional savings.
FAQ
Frequently asked questions
What's the difference between short-term and long-term gains?
Gains on investments held one year or less are short-term and taxed like wages. Gains on investments held more than a year are long-term and taxed at lower rates: 0%, 15% or 20%.
What is the net investment income tax?
An extra 3.8% tax on investment income, including capital gains, for people with income above $200,000 (single) or $250,000 (married filing jointly).
How are long-term gains taxed if I have a salary?
Gains are stacked on top of your other taxable income. If your salary already fills the 0% range, your gains start at 15%.
What about selling my home?
Up to $250,000 of gain ($500,000 for married couples) on a main home may be excluded if you meet ownership and use tests. This calculator doesn't model that exclusion.
Can losses offset gains?
Yes. Capital losses offset gains, and up to $3,000 of extra losses a year can offset other income. Unused losses carry forward.
Keep going
Recommended next
Related calculators and guides, sorted for your profile.
- TaxesMarginal vs Effective Tax RateSee your top tax bracket, your average tax rate, and how much of your next raise you'd actually keep.
- RetirementRoth vs TraditionalCompare Roth and traditional (pre-tax) contributions based on your tax rate now and in retirement.
- InvestingNet Worth CalculatorAdd up what you own and what you owe to see your net worth, liquid net worth and debt-to-asset ratio.
- Student Loans & PSLFDental School Debt ProjectorProject dental school debt at graduation, how much must be private, and the payment it implies.
- Student Loans & PSLFExtra Student Loan PaymentSee the interest and time you save by paying extra on your student loans each month.
- Student Loans & PSLFForgiveness Tax Bomb EstimatorEstimate the tax owed when an income-driven repayment balance is forgiven, and how much to save for it.