Capital Gains Tax Calculator
A capital gain or loss generally equals sale proceeds minus adjusted cost basis. Selling expenses such as brokerage commissions and transaction fees can reduce the amount realized, which lowers the taxable gain. Whether a gain is short-term or long-term depends on how long you held the investment: assets held for one year or less are generally short-term, while assets held for more than one year are generally long-term.
Short-term capital gains generally flow through ordinary federal income-tax brackets. Standard long-term capital gains may qualify for preferential federal rates of 0%, 15%, or 20%. The applicable long-term rate depends on your total taxable income, not solely on the size of the gain — different portions of the same gain can fall in different rate bands. Some higher-income taxpayers may also owe the Net Investment Income Tax (3.8%). Capital losses may offset capital gains and, within limits, a limited amount of ordinary income.
Special assets and transactions — including primary-home sales, rental and business property, depreciation recapture, collectibles, employee stock options, and wash sales — can require different rules. This calculator estimates a federal tax scenario for standard investment-asset sales. It does not prepare Form 8949, Schedule D, Form 8960, a federal income-tax return, or a state income-tax return, and the result is not an exact tax bill.
Tax Year and Asset
Asset type is descriptive. The standard calculation applies to all types listed.
Transaction Scope
Transaction Entry Mode
Transaction Details
Enter date in YYYY-MM-DD format.
Enter date in YYYY-MM-DD format.
Filing Status and Other Income
Used for long-term rate thresholds, brackets, NIIT, and loss limits in Phase 2.
Enter estimated taxable income after deductions, excluding the capital gain or loss modeled here.
Qualified dividends share long-term capital-gain rate bands and will be used in Phase 2 stacking.
Prior-Year Capital-Loss Carryovers
Short-term and long-term carryovers retain their character. Enter them separately for an accurate Schedule D calculation.
Net Investment Income Tax Inputs (Optional)
Enter MAGI and other net investment income to estimate the 3.8% Net Investment Income Tax. Leave blank to skip NIIT estimation. The 2026 NIIT threshold is $200,000 (single/HOH), $250,000 (MFJ/QSS), or $125,000 (MFS).
Enter your estimated MAGI before this transaction. Leave blank to skip NIIT.
Other NII such as interest, dividends, and prior capital gains not from this transaction.
Investment expenses properly allocable to net investment income. Optional. Form 8960 may require additional adjustments not modeled here.
State and Local Tax Estimate (Optional)
States may use different definitions of basis, taxable income, capital losses, deductions, exclusions and tax rates. This manual estimate does not apply state-specific tax law. It is not an official state withholding or tax-return calculation.
What Is a Capital Gain or Loss?
A capital gain or loss is determined by a two-step calculation:
Capital gain or loss = Amount realized − Adjusted cost basis
Amount realized = Gross sale proceeds − Selling expenses
Gross sale proceeds are the total amount received before subtracting any selling costs. Selling expenses are direct costs of the disposition, such as brokerage commissions and exchange fees, that reduce the amount received. Amount realized is what remains after subtracting selling expenses from gross proceeds. Original cost is the purchase price paid. Adjusted cost basis starts with the original cost and is increased by purchase commissions, certain acquisition fees, and other capitalized costs, then reduced by return-of-capital distributions and applicable prior adjustments.
A capital gain results when the amount realized exceeds adjusted cost basis. A capital loss results when adjusted cost basis exceeds the amount realized. The taxable gain is not the full gross proceeds.
Example: A person sells an investment for $40,000 after paying $25,000 for it. They do not have a $40,000 taxable gain. The calculation uses the difference: $40,000 proceeds minus $25,000 adjusted basis equals a $15,000 gain. If there were $100 in selling expenses, the amount realized is $39,900 and the gain is $14,900.
What Is Adjusted Cost Basis?
Adjusted cost basis represents your tax investment in an asset. It begins with the original purchase price and may be increased or decreased by several types of adjustments.
Basis increases can include: purchase commissions, certain acquisition fees, additional investments in the property, certain capitalized costs, and other applicable adjustments that increase the tax cost.
Basis decreases can include: return-of-capital distributions that were not taxed when received, prior tax adjustments, certain reimbursements, and other applicable reductions.
Reinvested dividends generally create new purchases or additional tax lots — each reinvestment has its own acquisition date and its own basis equal to the amount reinvested. They generally do not simply add to the basis of the original lot without tracking the associated shares and acquisition dates. Review your brokerage records or year-end tax statements for per-lot detail.
Inherited and gifted property can have special basis rules — inherited property may use a stepped-up basis at the date of death, and gifted property can have dual-basis rules depending on whether there is a gain or loss at the time of transfer. These special rules are not fully calculated by this standard tool.
What Are Selling Expenses?
Direct costs of selling an investment may reduce the amount realized. Possible examples include brokerage commissions paid on the sale, exchange fees, transaction fees, certain legal costs directly associated with the sale, and other direct disposition expenses.
Do not subtract a selling expense again when it is already reflected in Form 1099-B proceeds, brokerage-reported net proceeds, adjusted basis, or a transaction-summary amount. This calculator includes an option to mark whether expenses are already reflected in proceeds.
General financial-advisor management fees, account maintenance fees, and ongoing investment expenses are not the same as direct selling commissions. Do not add ongoing management fees to basis or deduct them from sale proceeds unless they qualify as a direct selling cost for this transaction.
Short-Term Versus Long-Term Capital Gain
The holding period determines whether a capital gain or loss is short-term or long-term:
- A capital asset held for one year or less is generally short-term.
- A capital asset held for more than one year is generally long-term.
Counting generally begins the day after the acquisition date. The sale date is included in the holding period. Exact acquisition and disposition dates matter — crossing into a new calendar year does not automatically create long-term treatment.
Example: Purchased January 15, 2024. One year later is January 15, 2025 — selling on that date is still short-term (exactly one year, not more than one year). Selling on January 16, 2025 or later qualifies as long-term.
Inherited property, certain gifted property, securities transactions, short sales, and other special situations may use different holding-period rules not modeled by this standard calculator.
How Short-Term Capital Gains Are Taxed
Net short-term capital gains are generally taxed through the ordinary federal income-tax brackets — the same brackets that apply to wages and most other ordinary income. A short-term gain is added to other ordinary taxable income. Different portions of the gain can fall within different ordinary tax brackets, so the entire gain is not necessarily taxed at the taxpayer's highest marginal rate.
This calculator estimates the transaction's incremental federal tax by comparing federal tax before and after the modeled transaction. Capital losses and carryovers are netted before the taxable short-term amount is determined. Short-term capital gains do not have one universal flat tax rate.
How Long-Term Capital-Gain Rates Work
Standard net long-term capital gains may be taxed at 0%, 15%, or 20% under the tax-stacking method:
- Ordinary taxable income fills the lower portion of taxable income.
- Qualified dividends and eligible net long-term capital gain are stacked above ordinary taxable income.
- The applicable filing-status thresholds determine how much falls within each preferential rate band.
- Different portions of one gain may be taxed at different rates.
A taxpayer whose income crosses the 0% threshold does not pay 15% on the entire gain — only the portion above the threshold is taxed at 15%. Standard 0%, 15%, and 20% rates apply to ordinary investment assets; they do not apply to excluded special categories such as collectibles (taxed up to 28%) or unrecaptured Section 1250 gain.
2026 Long-Term Capital-Gain Rate Bands
The table below shows the taxable-income thresholds for the 0% and 15% long-term capital-gain bands for tax year 2026. Gain above the 15% threshold enters the 20% band.
| Filing Status | Top of 0% Band | Top of 15% Band |
|---|---|---|
| Single | $49,450.00 | $545,500.00 |
| Married Filing Jointly / Qualifying Surviving Spouse | $98,900.00 | $613,700.00 |
| Married Filing Separately | $49,450.00 | $306,850.00 |
| Head of Household | $66,200.00 | $579,600.00 |
These are taxable-income thresholds, not gain-size thresholds. Ordinary taxable income and qualified dividends can use part of the available bands. Applicable federal tax year: 2026.
Qualified Dividends and Capital Gains
Qualified dividends generally use the same preferential federal rate bands as standard net long-term capital gains. Under the stacking method, qualified dividends are placed above ordinary income first, which can reduce the amount of the 0% or 15% band available for a modeled investment gain.
Ordinary dividends are not entered in the qualified-dividend field — only dividends that qualify for the preferential rate apply. Qualified dividends must not be taxed once as ordinary income and again through the preferential-rate calculation. The calculator avoids double-counting qualified dividends. See also the Dividend Income Calculator for dividend-focused analysis.
Net Investment Income Tax (NIIT)
The Net Investment Income Tax is a separate 3.8% federal tax. It is generally calculated on the lesser of net investment income or modified adjusted gross income (MAGI) above the applicable filing-status threshold. Not every capital gain is subject to NIIT — the tax applies only when MAGI exceeds the threshold.
| Filing Status | NIIT MAGI Threshold |
|---|---|
| Single | $200,000 |
| Head of Household | $200,000 |
| Married Filing Jointly | $250,000 |
| Qualifying Surviving Spouse | $250,000 |
| Married Filing Separately | $125,000 |
These NIIT thresholds are different from ordinary federal income-tax brackets, long-term capital-gain rate thresholds, and standard-deduction amounts. Form 8960 can require additional adjustments that the simplified calculator does not fully reproduce.
Capital-Loss Netting
Short-term and long-term gains and losses are initially tracked separately. The general netting sequence:
- Net short-term gains and losses.
- Net long-term gains and losses.
- Offset a net loss in one category against a net gain in the other.
- Determine whether the final result is a net short-term gain, net long-term gain, or net capital loss.
- Apply capital-loss deduction and carryover rules.
Prior-year short-term and long-term loss carryovers retain their respective character. A combined carryover input is less accurate than separate short-term and long-term carryover information, because the two categories offset gains of different types and tax rates differently.
Capital Loss Against Ordinary Income
After capital losses offset capital gains, an individual may generally deduct a limited amount of net capital loss against ordinary income:
- Up to $3,000 for most filing statuses
- Up to $1,500 for Married Filing Separately
Additional unused loss may carry to a future tax year, retaining its short-term or long-term character. Capital-loss carryovers do not expire. The calculator's carryover estimate can be simplified when it does not have all values from the prior year's Schedule D Capital Loss Carryover Worksheet. The estimated future tax value of a carryover is not current cash proceeds from the sale.
Wash-Sale Rules
A loss on stock or securities may be disallowed when substantially identical stock or securities are acquired during the period beginning 30 days before and ending 30 days after the sale date. That period contains 61 calendar days.
The disallowed loss may be added to the replacement investment's adjusted basis, and holding-period adjustments may also apply. Determining whether investments are substantially identical can require additional analysis beyond the transaction dates alone.
This calculator provides a warning when you indicate a potential wash sale, but does not perform a complete wash-sale calculation. A potentially disallowed loss should not be treated as definitely deductible until that analysis is complete.
Net Proceeds Versus Taxable Gain
These are separate concepts:
Taxable gain = Amount realized − Adjusted basis
Cash proceeds after taxes = Gross proceeds − Selling expenses − Modeled taxes
Cost basis measures your investment in the asset — it is not itself a tax. Basis represents money you already spent, which is being returned to you tax-free as part of the proceeds. Basis should not be subtracted twice from cash proceeds. A capital-loss tax benefit is not cash received at the time of sale; it reduces tax owed on other income, which is a separate benefit from the sale proceeds themselves.
State Capital-Gains Taxes
State treatment of capital gains varies by jurisdiction. States can differ in tax rates, income definitions, capital-gain exclusions, deductions, loss treatment, carryover rules, basis adjustments, and local taxes. This calculator's state field is a manually entered estimate — it does not infer your state or tax rate from browser location, and a manually entered percentage is not an official state tax calculation. Review your state's tax instructions or consult a qualified tax professional for state-specific guidance.
Special Transactions Excluded From Standard Calculation
The standard calculator does not fully calculate:
Worked Example: Long-Term Capital Gain (2026)
These assumptions are used to illustrate how the calculation works. All values are generated by the live calculator engine. When the 2026 federal configuration changes, this example updates automatically.
The 0% portion occurs because other taxable income ($40,000) leaves $9,450.00 of space below the 0%→15% threshold of $49,450.00. Only the remaining gain above that threshold is taxed at 15%.
Worked Example: Short-Term Capital Gain (2026)
The $50,000 of other income already occupies the 10% and 12% brackets. The short-term gain stacks above that income, partly in the 12% bracket and partly in the 22% bracket. The entire gain is not taxed at one flat 22% rate — the effective incremental rate is 21.6%.
Worked Example: Capital Loss Netting (2026)
Step 1: Net short-term: no ST gains, $10,000 ST loss → net ST loss of $10,000.
Step 2: Net long-term: $8,000 LT gain, no LT losses → net LT gain of $8,000.
Step 3: Cross-net: $8,000 LT gain offsets $8,000 of the $10,000 ST loss → remaining net capital loss of $2,000 (retains short-term character).
The estimated federal tax reduction is the difference between federal tax on $60,000 and federal tax on $58,000 using 2026 single brackets. This reduction is a future-tax benefit, not cash received from the sale itself.
Frequently Asked Questions
How do I calculate a capital gain?
What is adjusted cost basis?
Do selling expenses reduce a capital gain?
What is the difference between short-term and long-term gains?
How is the one-year holding period counted?
Are short-term gains taxed at a flat rate?
What are the 2026 long-term capital-gain tax rates?
Can part of one gain be taxed at 0% and another part at 15%?
How do qualified dividends affect capital-gain tax?
What is the Net Investment Income Tax?
Is NIIT the same as the 20% capital-gain rate?
How do capital losses offset capital gains?
How much capital loss can I deduct against ordinary income?
What happens to unused capital losses?
What is a wash sale?
Does this calculator handle cryptocurrency sales?
Does it calculate the home-sale exclusion?
Does it calculate tax on collectibles?
Does it calculate depreciation recapture?
Does it include state capital-gains tax?
Is cost basis subtracted when calculating net proceeds?
Why might my brokerage basis differ from my records?
Does the calculator replace Form 8949 or Schedule D?
Is this an official IRS calculator?
Privacy Notice
Calculator values are processed locally in your browser and are not intentionally transmitted to our servers. This calculator does not require or collect your name, email address, telephone number, street address, Social Security number, brokerage account number, brokerage login credentials, tax returns, Form 1099-B uploads, or bank credentials. Website hosting, consent, analytics, and advertising services may process technical information as described in our Privacy Policy.
Sources and Methodology
Methodology
- Holding period is calculated using exact acquisition and sale dates; counting begins the day after acquisition and the sale date is included.
- Basis and proceeds come from user-entered values; selling expenses reduce the amount realized unless marked as already reflected in proceeds.
- Short-term gains use centralized ordinary federal brackets from
taxConfig.js(same data as the Tax Estimator). - Long-term gains use the tax-stacking method: ordinary income below the gain, qualified dividends stacked next, then long-term gain allocated across 0%, 15%, and 20% bands.
- Qualified dividends share preferential rate bands and are stacked before capital gain to correctly model their interaction.
- Federal tax is calculated using a before-and-after comparison: tax on ordinary income plus the gain, minus tax on ordinary income alone.
- NIIT is calculated separately on the lesser of net investment income or MAGI above the applicable threshold.
- State tax is a manual estimate; no state-specific tax law is applied.
- Capital-gain netting follows IRC §1222: short-term and long-term separately, then cross-netting.
- Prior-year capital-loss carryovers retain their character per IRC §1212.
- Loss carryover estimates may be simplified when prior-year Schedule D Capital Loss Carryover Worksheet values are unavailable.
- Special transaction categories are excluded from the standard calculation.
- Wash-sale detection is limited to a user-answered question; no automated substantially-identical determination is made.
Official Sources
- IRS Topic No. 409 — Capital Gains and Losses
- IRS Publication 550 — Investment Income and Expenses
- IRS Publication 551 — Basis of Assets
- IRS Form 8949 and Instructions — Sales and Other Dispositions of Capital Assets
- IRS Schedule D (Form 1040) and Instructions
- Qualified Dividends and Capital Gain Tax Worksheet (Schedule D Instructions)
- Revenue Procedure 2025-32 — 2026 Inflation Adjustments
- IRS Form 8960 and Instructions — Net Investment Income Tax
- IRS Net Investment Income Tax Guidance
- IRS Wash-Sale Rule Guidance (IRC §1091)
Applicable federal tax year: 2026
Last reviewed: August 3, 2026
Related Calculators
About This Calculator
Publisher: Smart Finance Calculators Editorial Team. This page has not been reviewed by a certified public accountant, attorney, tax professional, or investment adviser.
Validation: The calculation engine is validated against the worked examples published in IRS Publication 550, the Schedule D instructions, and the Qualified Dividends and Capital Gain Tax Worksheet. Automated tests compare engine output against those published figures.
Applicable federal tax year: 2026 · Last reviewed: August 3, 2026
Disclaimer
This calculator provides an educational estimate based on user-entered information and selected federal tax-year data. It does not constitute tax, legal, investment, accounting or financial advice and does not prepare Form 8949, Schedule D, Form 8960 or a tax return. Actual basis, gain classification, capital-loss treatment, Net Investment Income Tax, state tax and special transaction rules depend on individual circumstances and current law.