Calculate capital gains tax on stock sales. Estimate federal tax on short-term and long-term gains based on your income and filing status.
15.0% effective tax rate
You'll keep $4,250 of your $5,000 gain after paying $750 in federal taxes.
This is an estimate for federal taxes only. State taxes may apply. Consult a tax professional for personalized advice.
Capital gains tax is a federal tax on the profit you make when selling stocks or other investments for more than you paid. When you sell a stock at a higher price than your purchase price, the difference is your capital gain, and the IRS requires you to pay tax on this profit.
The tax system distinguishes between two types of capital gains based on how long you held the investment:
This distinction creates a significant tax incentive to hold investments for longer periods. A high-income investor selling stock after 11 months might pay 37% tax on their gain, while waiting just one more month could reduce their rate to 20% or even 15%.
The capital gains tax calculation involves several steps:
Your cost basis is the original purchase price of the stock plus any transaction costs like commissions or fees. If you've reinvested dividends or made additional purchases, your cost basis becomes more complex and may require specific accounting methods like FIFO (first in, first out) or specific identification.
The tax rate depends on:
Long-term capital gains enjoy preferential tax rates that are significantly lower than ordinary income rates:
| Tax Rate | Single Filers (2025) | Married Filing Jointly (2025) | Head of Household (2025) |
|---|---|---|---|
| 0% | Up to $48,350 | Up to $96,700 | Up to $64,750 |
| 15% | $48,351 - $533,400 | $96,701 - $600,050 | $64,751 - $566,700 |
| 20% | Over $533,400 | Over $600,050 | Over $566,700 |
These thresholds are based on your total taxable income, not just your capital gains. If your regular income plus your capital gains pushes you into a higher bracket, part of your gain may be taxed at a higher rate.
Short-term gains are added to your ordinary income and taxed at your marginal tax rate. For 2025, the ordinary income brackets are:
| Tax Rate | Single Filers | Married Filing Jointly |
|---|---|---|
| 10% | Up to $11,925 | Up to $23,850 |
| 12% | $11,926 - $48,475 | $23,851 - $96,950 |
| 22% | $48,476 - $103,350 | $96,951 - $206,700 |
| 24% | $103,351 - $197,300 | $206,701 - $394,600 |
| 32% | $197,301 - $250,525 | $394,601 - $501,050 |
| 35% | $250,526 - $626,350 | $501,051 - $751,600 |
| 37% | Over $626,350 | Over $751,600 |
High-income investors may also owe an additional 3.8% Net Investment Income Tax on their capital gains. This surtax applies when your modified adjusted gross income exceeds:
The NIIT is calculated on the lesser of your net investment income or the amount by which your income exceeds the threshold. This means a single filer with $250,000 in total income and $30,000 in capital gains would owe 3.8% NIIT on $30,000 (the full gain, since it's less than the $50,000 excess over the threshold).
Your cost basis is crucial for accurately calculating capital gains. It includes:
When you've purchased the same stock at different times and prices, you need a method to determine which shares you're selling:
FIFO (First In, First Out): The default method assumes you sell your oldest shares first. This often results in higher gains if the stock has appreciated over time.
Specific identification: You choose exactly which shares to sell, potentially minimizing your tax liability by selling higher-cost shares first.
Average cost: Primarily used for mutual funds, this method averages the cost of all shares purchased.
Not every stock sale results in a gain. When you sell a stock for less than your cost basis, you have a capital loss. These losses can be valuable for tax purposes:
Tax-loss harvesting is the strategy of intentionally selling losing positions to realize losses that offset gains. This can reduce your current-year tax bill while maintaining your investment position by purchasing a similar (but not identical) investment.
The IRS prevents you from claiming a tax loss if you buy "substantially identical" securities within 30 days before or after the sale. This 61-day window (30 days before, the sale day, and 30 days after) is called the wash sale period.
If you trigger a wash sale, your loss is disallowed, but it's added to the cost basis of the replacement shares. You don't lose the benefit permanently—it's deferred until you eventually sell the replacement shares.
The most straightforward strategy is simply holding investments for at least one year and one day to qualify for long-term rates. The difference between short-term and long-term rates can be substantial—potentially 17 percentage points for high earners (37% vs. 20%).
Stocks held in retirement accounts like 401(k)s, IRAs, and Roth IRAs aren't subject to capital gains tax when sold:
Consider your income in any given year when planning sales:
Donating appreciated stock to charity allows you to:
This is often more tax-efficient than selling the stock, paying the tax, and donating cash.
Investing capital gains in Qualified Opportunity Zone funds can defer and potentially reduce capital gains taxes, though these investments carry their own risks and require holding periods of at least 10 years for maximum benefit.
Stock sales are reported on Schedule D of your tax return, with detailed information on Form 8949. Your broker provides Form 1099-B showing your sales proceeds, and you're responsible for reporting the correct cost basis and calculating gains or losses.
Key forms include:
Most brokerages now report cost basis to the IRS for stocks purchased after 2011, but you should verify this information and maintain your own records for accuracy.
Stock inherited from a deceased person receives a "stepped-up basis" to the fair market value at the date of death. This eliminates capital gains tax on appreciation that occurred during the decedent's lifetime—a significant tax benefit for heirs.
When you receive stock as a gift, you generally take the donor's cost basis. However, if the stock's fair market value at the time of the gift is less than the donor's basis, special rules apply to prevent you from claiming a loss.
Stock compensation has unique tax treatment:
Federal taxes are just one component of your total tax liability. Many states also tax capital gains:
State tax treatment can significantly affect your total tax bill, especially for large gains.
This calculator provides estimates for federal capital gains tax only. Actual tax liability may vary based on:
For significant investment decisions or complex tax situations, consult a qualified tax professional who can consider your complete financial picture and provide personalized guidance.