How to use the Capital Gains Tax
- Enter your cost basis — the purchase price plus commissions and any reinvested distributions.
- Enter the sale proceeds net of selling fees.
- Choose whether you held the asset more than one year.
- Set your long-term rate bracket (0%, 15% or 20%) and your ordinary income bracket.
- Add a state rate if your state taxes capital gains, then compare the long-term saving line.
How the calculation works
The holding period is the single biggest lever in the calculation. Assets held more than one year are taxed at preferential long-term rates of 0%, 15% or 20% depending on taxable income; anything held a year or less is taxed as ordinary income, which can reach 37% federally. The threshold is measured from the day after acquisition to the day of sale, and being a day short converts the entire gain to ordinary treatment.
Cost basis is where errors accumulate. It includes purchase commissions and, for funds, every reinvested dividend already taxed in prior years — forgetting those means paying tax twice on the same money. Brokers report basis for most securities acquired after 2011, but inherited assets get a step-up to date-of-death value and gifted assets carry the donor's basis, and neither is always on the 1099-B.
This estimate omits several real complications: the 3.8% net investment income tax that applies above $200,000 single or $250,000 married, the fact that long-term brackets are income-dependent so a large gain can push part of itself into a higher band, and state treatment that ranges from full exemption to taxing gains as ordinary income. Capital losses offset gains dollar for dollar and up to $3,000 of ordinary income a year, with the rest carried forward indefinitely.
Gain = proceeds − basis; tax = gain × applicable rate (long-term 0/15/20%, or ordinary bracket if held ≤ 1 year) + state rateSource: IRS Publication 550, Investment Income and Expenses; IRC §1(h) capital gain rates; IRC §1411 net investment income tax.
Worked example
Shares bought for $10,000 and sold for $18,000 after two years, 15% long-term rate, 24% ordinary bracket.
- Gain = 18,000 − 10,000 = $8,000, an 80% return.
- Long-term federal tax = 8,000 × 15% = $1,200.
- After-tax proceeds = 18,000 − 1,200 = $16,800.
- Selling within a year instead: 8,000 × 24% = $1,920.
$1,200 of federal tax, and holding past the one-year mark saved $720 — 9% of the entire gain.
Frequently asked questions
How long is long-term?+
More than one year, counted from the day after purchase to the sale date. One year exactly is still short-term.
Can losses reduce my tax?+
Yes. Losses offset gains without limit, and up to $3,000 of net loss offsets ordinary income each year, with the remainder carried forward.
Does this apply to my home?+
Primary residences have a separate exclusion of $250,000 single or $500,000 married on gains, if you lived there two of the last five years.
What is the net investment income tax?+
An extra 3.8% on investment income above $200,000 single or $250,000 married filing jointly. It is not included in this estimate.
Last reviewed September 1, 2026. We review this page whenever the underlying formula, tax year, published rate or standard changes.