The capital gains tax calculator above gives you a fast, realistic estimate of what you'll owe the federal government when you sell a stock, a piece of real estate, or another appreciated asset. Enter what you paid, what you sold it for, how long you held it, and your income, and it walks through the same logic the IRS uses: figure out the gain, classify it as short-term or long-term, apply the right rate, and layer on the Net Investment Income Tax if you're above the threshold.
We built this tool because most people only think about capital gains tax after they've already sold β when it's too late to plan. Arb Digital put this calculator together as one of our free tools so you can run the numbers before you sell, not after, and see roughly how much of your profit you actually keep.
What This Capital Gains Tax Calculator Does
It takes five inputs β purchase price, sale price, holding period, taxable income, and filing status β and returns your estimated capital gains tax, the total dollar gain, the tax rate that applied, your net proceeds after tax, and any additional Net Investment Income Tax (NIIT) owed. The calculator recognizes the single most important variable in capital gains taxation: how long you held the asset. Assets held over one year get preferential long-term rates. Assets held a year or less are taxed as ordinary income, at your regular marginal rate, which is almost always higher.
This isn't limited to stocks. The same math applies to selling a second home, an investment property, a stake in a private business, collectibles, or cryptocurrency (though crypto has its own quirks β see our dedicated crypto tax calculator below). Anywhere you have a capital asset with a cost basis and a sale price, this tool can estimate the tax hit.
How to Use It
- Enter your purchase price. This is your cost basis β what you paid, plus things like commissions or closing costs if you're tracking those separately.
- Enter your sale price. What you actually received (or expect to receive) for the asset.
- Pick your holding period. Long-term means you owned the asset for more than one year before selling; short-term means one year or less.
- Choose your filing status. Single or married filing jointly β this shifts where the tax brackets fall.
- Enter your taxable income. This is the income figure the IRS uses to decide which bracket your gain lands in, before the gain itself is added.
- Hit Calculate. The tool instantly shows your estimated tax, rate applied, net proceeds, and NIIT exposure.
The Formula β How It's Calculated
The math starts simple: gain = sale price β purchase price. From there, the rate depends entirely on your holding period and income.
For a long-term gain (asset held over one year), the IRS applies one of three preferential rates based on your taxable income: 0%, 15%, or 20%. For 2025, illustrative single-filer thresholds are roughly $0β$48,350 for the 0% bracket, $48,351β$533,400 for 15%, and above that for 20%. For married filing jointly, the 0% bracket runs to about $96,700, 15% up to roughly $600,050, and 20% above. These numbers are illustrative 2025 figures you can edit β always confirm current thresholds at IRS.gov (Topic 409, Capital Gains and Losses).
For a short-term gain (held one year or less), there's no preferential rate at all β the IRS taxes it exactly like wages, at your ordinary marginal income tax rate, which this tool estimates by matching your entered taxable income to the 2025 bracket table (10% through 37%). That's often nearly double the long-term rate for the same dollar of profit, which is why holding period is the single biggest lever you control.
Finally, if your income is high enough, the calculator adds the Net Investment Income Tax (NIIT) β an extra 3.8% surtax on investment income for single filers with modified adjusted gross income over $200,000, or $250,000 for married filing jointly. This is a separate tax on top of the regular capital gains rate, and a lot of people forget to budget for it.
Short-Term vs Long-Term: Why the One-Year Mark Matters So Much
If there's one number worth memorizing in this whole topic, it's 366 days. Sell an asset on day 365 and you're taxed at ordinary rates, which can run as high as 37%. Wait one more day, cross into long-term territory, and the same gain might be taxed at 15% β sometimes 0%. On a $20,000 gain, that difference can be several thousand dollars, simply for waiting.
This is why so many investors deliberately hold winning positions past the one-year anniversary of purchase before selling, especially near year-end when a sale is close to the boundary. It's also why "tax-loss harvesting" β selling losing positions to offset gains β tends to happen in the final weeks of December, when investors are looking at their full-year gain picture and deciding what to lock in versus what to hold.
Keep in mind the holding period clock starts the day after you acquire the asset and ends the day you sell it. For inherited property, the IRS generally treats the holding period as automatically long-term regardless of how long the heir actually owned it β a detail that trips a lot of people up when they inherit a house or a stock portfolio.
Stocks vs Real Estate: A Few Practical Differences
The core tax math is the same whether you're selling shares or a duplex, but real estate has a few extra wrinkles worth knowing about. If the property was your primary residence for at least two of the last five years, you may be able to exclude up to $250,000 of gain ($500,000 for married couples) under the home-sale exclusion β a benefit stocks don't get. Investment or rental property, on the other hand, can trigger "depreciation recapture," which is taxed at up to 25% on the portion of gain attributable to depreciation you previously claimed, separate from the regular capital gains rate this calculator estimates.
Stocks are generally simpler: no depreciation recapture, and cost basis is usually just what you paid plus reinvested dividends. But stock sales can trigger the "wash sale" rule if you sell at a loss and buy a substantially identical security within 30 days β the loss gets disallowed for tax purposes. None of these edge cases are captured by a simplified calculator like this one, which is exactly why it's meant for planning estimates, not a substitute for a CPA when real money and real deadlines are on the line.
Ways to Reduce What You Owe
- Hold past one year. The single biggest, simplest lever β converts a short-term gain into a long-term one.
- Harvest losses. Selling losing positions in the same year can offset gains dollar-for-dollar, and up to $3,000 of net losses can offset ordinary income annually, with the rest carried forward.
- Time the sale around your income. Selling in a lower-income year (for example, after retiring or between jobs) can drop you into the 0% or 15% long-term bracket entirely.
- Use tax-advantaged accounts where possible. Gains inside a 401(k), IRA, or HSA aren't taxed the same way as gains in a regular brokerage account.
- Donate appreciated assets directly. Giving appreciated stock to a qualified charity instead of cash can avoid capital gains tax entirely while still getting a deduction.
Arb Digital builds fast, high-converting websites and content for businesses of every kind β while you're here, put our other free calculators to work on the rest of your tax picture.
Try the Income Tax Calculator All Free ToolsCommon Mistakes to Avoid
- Forgetting the NIIT surtax entirely when income is above the threshold β it's separate from the headline capital gains rate.
- Assuming short-term and long-term gains are taxed the same way β they're calculated on completely different scales.
- Not tracking cost basis accurately, especially for stock bought over multiple purchases (lots) at different prices.
- Forgetting that state income tax on capital gains is separate from β and in addition to β the federal tax this calculator estimates.
- Selling right before the one-year mark to "lock in" a gain, without realizing how much extra tax that costs.
- Ignoring capital losses that could offset the gain in the same tax year.
Related Free Tools From Arb Digital
If you're mapping out a fuller tax picture, check out the crypto tax calculator for digital asset sales, the dividend tax calculator for investment income, the income tax calculator for your overall federal bill, the tax bracket calculator to see exactly where your income falls, and the tax-equivalent yield calculator if you're comparing municipal bonds. You can find every calculator we've built in our free online tools hub.
Frequently Asked Questions
For 2025, long-term capital gains are taxed at 0%, 15%, or 20% depending on your taxable income and filing status. Short-term gains are taxed at your ordinary income tax rate, which ranges from 10% to 37%.
Subtract your purchase price (cost basis) from your sale price to get the gain, then apply the long-term or short-term rate based on how long you held the stock and your taxable income.
Any asset held for more than one year before it's sold qualifies for long-term capital gains treatment, which uses lower preferential tax rates than ordinary income.
No. A sale at a loss produces no capital gains tax, and the loss can typically be used to offset other gains or up to $3,000 of ordinary income per year.
NIIT is an additional 3.8% federal tax on investment income, including capital gains, for single filers with income over $200,000 or married couples filing jointly over $250,000.
No, this tool estimates federal capital gains tax only. Most states tax capital gains as regular income on top of the federal amount, so check your state's rules separately.
This tool provides general estimates for educational purposes only and is not financial, tax, legal, or medical advice. Figures are illustrative; consult a licensed professional for decisions.