Selling an investment, a second home, or company stock can create a gain — and the amount you actually keep depends heavily on how long you held it and which tax bracket the gain lands in. This capital gains calculator estimates the federal tax you owe when you sell, separating short-term gains (taxed at your ordinary income rate) from long-term gains (taxed at the lower 0%, 15%, or 20% brackets set by the IRS and reported on Schedule D of Form 1040).
Enter your sale proceeds, what you originally paid, and how long you held the asset. The result card shows your net gain, whether it is short- or long-term, the rate applied, the estimated tax, and what is left after tax. Moving a sale by even a few months can be the difference between a 22% bill and a 15% one — so run the numbers before you trade.
How to Use
- Enter the Sale Proceeds — the gross amount you receive from the buyer before any fees.
- Enter your Cost Basis. This is the original purchase price plus money you spent on improvements, transfer taxes, and reinvested dividends. A higher basis means a smaller gain and a smaller tax bill.
- Add Selling Costs such as broker commissions and closing fees. These reduce your taxable gain dollar for dollar.
- Set the Holding Period in months. The IRS threshold is one year plus one day: 12 months or less is short-term, more than 12 months is long-term.
- Enter your Ordinary Income Rate — your marginal federal bracket. This is only used for short-term gains, which are taxed exactly like wages.
- Enter your Other Taxable Income for the year. Your long-term gain is stacked on top of this income to decide whether it falls in the 0%, 15%, or 20% bracket.
The engine first computes netGain = saleProceeds - costBasis - sellingCosts. If the result is zero or negative, you have a breakeven or a loss and no tax is due. For a long-term gain, it then walks the gain through the 2025 Single-filer brackets — 0% up to $48,350, 15% from there to $533,400, and 20% above that — applying each rate only to the slice of gain that reaches that band.
How Capital Gains Are Taxed
A capital gain is simply the difference between what you sold an asset for and what it cost you. The IRS splits gains into two buckets based on holding period, and the rate difference is the single biggest lever in tax planning for investors.
Short-term gains — assets held one year or less — are added to your wages and taxed at your ordinary income rate. If you are in the 22% bracket, flipping a stock for a quick profit costs 22 cents on the dollar, plus any state tax.
Long-term gains — assets held more than one year — get a preferential rate. For 2025, a single filer pays 0% on gains up to $48,350 of taxable income, 15% from $48,351 to $533,400, and 20% above that. Married couples filing jointly have wider bands (0% up to $96,700). Because the gain is layered on top of your other income, someone earning $90,000 and realizing a $30,000 long-term gain pays 15% on most of it, while a retired person with very low income may pay 0%.
This is why holding for the long term is so valuable: the same $65,000 gain at a 22% ordinary rate is $14,300 in tax, while at a 15% long-term rate it is $9,750. Extending your holding period by a few months can keep you in the lower bracket entirely.
Examples
Example 1 — A typical long-term sale. You sell stock for $150,000 that cost you $80,000 to buy, with $5,000 in commissions. You held it 24 months and your other taxable income is $100,000. Your net gain is $65,000, it is long-term, and it lands in the 15% bracket. Estimated tax is $9,750, leaving $55,250 after tax.
Example 2 — The same gain, flipped quickly. Everything is identical except you sold after 6 months. Now the $65,000 gain is short-term and taxed at your 22% ordinary rate. Estimated tax jumps to $14,300, and you keep only $50,700 — about $4,550 less for an identical economic gain, solely because of the holding period.
Example 3 — The 0% bracket. A part-time worker with $0 of other taxable income sells appreciated shares for a $20,000 long-term gain. Because the whole gain sits below the $48,350 threshold, the rate is 0% and estimated tax is $0. This is the strategy behind "gain harvesting" in low-income years.
Example 4 — A seven-figure sale. You sell a rental property for $1,500,000 against a $600,000 basis and $90,000 in selling costs. Your other taxable income is $600,000. The $810,000 gain is long-term and, because your income already exceeds the 15% ceiling, the entire gain is taxed at the 20% bracket — $162,000 in estimated tax.
FAQ
What is the difference between short-term and long-term capital gains?
Short-term gains come from assets held one year or less and are taxed at your ordinary income rate (10% to 37% federally). Long-term gains come from assets held more than one year and are taxed at the preferential 0%, 15%, or 20% rates. The holding period is the main factor that determines how much you owe.
How much tax do I pay on a stock or investment sale?
Subtract your cost basis and selling costs from the sale proceeds to get your net gain. If you held it over a year, apply the 0/15/20% bracket based on your total taxable income; if one year or less, apply your ordinary income rate. Enter your numbers above for an exact estimate.
What are the 2025 long-term capital gains tax brackets?
For a single filer in 2025, the 0% rate applies to taxable income up to $48,350, the 15% rate applies from $48,351 to $533,400, and the 20% rate applies above $533,400. Married filing jointly uses roughly double the 0% threshold ($96,700). These brackets are adjusted for inflation each year.
What is my cost basis and how do I calculate it?
Your cost basis is what you paid for the asset plus additions such as purchase commissions, transfer taxes, and improvements. For stocks, reinvested dividends also raise your basis. A higher basis reduces your taxable gain, so keep your purchase records and 1099-B forms on file.
How long must I hold an asset to get the long-term rate?
You must hold the asset for more than one year — technically, one year plus one day from the day after purchase to the day of sale. Check the trade dates on your brokerage statement; selling even a few days early can push the entire gain into the higher short-term bracket.
Do I pay state tax on capital gains too?
Yes. This calculator estimates federal tax only. Most states tax capital gains as ordinary income, though a few (such as California at the high end) apply their own brackets, and states like Texas and Florida have no income tax at all. Add your state's marginal rate for a complete picture.
Related Calculators
- Capital Gains Tax Calculator — a focused view of the federal tax due on an investment sale.
- Capital Gains Home Sale Calculator — apply the $250,000 / $500,000 home-sale exclusion.
- IRA Contribution Calculator — shelter new gains inside a Roth or Traditional IRA.
- Roth IRA Calculator — project tax-free Roth growth in retirement.
- 401(k) Calculator — grow tax-deferred assets and reduce taxable income.
Disclaimer
This capital gains calculator is provided for informational purposes only and does not constitute tax, legal, or investment advice. Estimates use the 2025 federal long-term brackets for a single filer and do not include the 3.8% Net Investment Income Tax, depreciation recapture, state taxes, or transaction-specific rules. Actual liability depends on your filing status, deductions, and full tax return. Always confirm your figures with a qualified tax professional or refer to IRS Schedule D (Form 1040) before filing. For our editorial standards see the About page, and for data handling see the Privacy Policy; we do not store your sale figures on this page.