You sold shares of stock, an ETF, or another investment and locked in a gain. Now comes the question every investor faces: how much of that profit will you owe in federal taxes? The answer depends on two critical factors: how long you held the asset and your taxable income for the year. Get either calculation wrong, and you might overpay or face an unexpected bill when you file your return.

How the Calculation Works

The IRS divides capital gains into two categories based on your holding period. If you sell an investment you owned for one year or less, the profit is a short-term capital gain. If you held the asset for more than one year before selling, it becomes a long-term capital gain. According to the Internal Revenue Service, this distinction is the primary driver of your tax liability (IRS, 2026).

Short-term gains are taxed as ordinary income, meaning they face the same federal rates as your salary, wages, or self-employment income. For 2026, those rates range from 10% to 37% depending on your filing status and total taxable income. Long-term gains, by contrast, benefit from preferential rates: 0%, 15%, or 20%. Most middle-income investors fall into the 15% bracket, while high earners with taxable income above $533,400 (single) or $600,050 (married filing jointly) face the 20% rate. Lower-income filers may owe nothing at all on long-term gains if their income stays below $47,025 (single) or $94,050 (joint).

Your calculation starts with three inputs: the sale price (proceeds), the cost basis (what you originally paid, including commissions), and the holding period. Subtract the basis from the proceeds to find your gain. Then apply the rate that matches your holding period and income bracket. If you sold multiple positions during the year, you net your short-term gains and losses together, and your long-term gains and losses together, before applying the appropriate rates. As covered in Principles of Finance, understanding the time value of money and tax consequences is foundational to effective investment decision-making.

A Worked Example

Suppose you bought 100 shares of an S&P 500 ETF at $400 per share in March 2025, paying $40,000 total. In July 2026, you sell all 100 shares at $480 each, receiving $48,000. Your gain is $8,000. Because you held the shares for 16 months, this is a long-term capital gain.

You file as single and your taxable income for 2026 (including this gain) is $95,000. According to the U.S. Securities and Exchange Commission investor guidance, understanding your tax bracket helps you estimate after-tax returns (SEC, 2026). At that income level, you fall into the 15% long-term capital gains bracket. Your federal tax on the $8,000 gain is $1,200, leaving you with $6,800 after tax.

Now imagine an alternative scenario: you bought the same ETF in March 2026 and sold it in July 2026, a holding period of only four months. The $8,000 gain is now short-term. With $95,000 in taxable income, you sit in the 22% ordinary income bracket (for single filers in 2026). Your federal tax on the gain jumps to $1,760, and your after-tax profit drops to $6,240. The $560 difference stems entirely from the holding period, as explained in foundational investment texts (Investopedia, 2026).

Read also: Capital Gains Tax in the US: Short-Term vs Long-Term Rates Explained

State Taxes and the Net Investment Income Tax

The federal calculation above does not include state income taxes, which most states apply to capital gains at their ordinary income rates. California, for instance, treats all capital gains as regular income, adding up to 13.3% in state tax on top of federal liability. A few states, such as Florida and Texas, impose no state income tax at all.

High-income investors face an additional 3.8% Net Investment Income Tax on capital gains if their modified adjusted gross income exceeds $200,000 (single) or $250,000 (joint). This surtax applies on top of the standard long-term or short-term rate and can push the effective federal rate on long-term gains to 23.8% for top earners.

Why Holding Period Matters

The rate difference between short-term and long-term treatment can be substantial. A single filer earning $120,000 in 2026 would face a 24% federal rate on short-term gains but only 15% on long-term gains. On a $10,000 gain, that nine-percentage-point spread translates to $900 in additional tax for selling one day too early. For buy-and-hold investors, this structure rewards patience. For active traders, the cumulative tax drag from repeated short-term gains can significantly erode compound returns over time.

Investors who realize losses can offset gains dollar-for-dollar within each category (short-term losses against short-term gains, long-term losses against long-term gains), and up to $3,000 of excess losses can be deducted against ordinary income each year. Unused losses carry forward indefinitely, making tax-loss harvesting a common year-end strategy.

When to Run the Numbers

You should estimate your capital gains tax liability before you sell, especially if the transaction is large or you are close to an income threshold. Selling late in the year leaves little room to adjust withholding or make estimated payments, and an underpayment can trigger penalties. A calculator helps you model different scenarios: holding until the position qualifies for long-term treatment, pairing the sale with a loss to offset the gain, or spreading sales across multiple tax years to stay in a lower bracket.

This information is educational and not personalized tax advice. Tax laws change, and individual circumstances vary. Consult a CPA or enrolled agent for guidance on your specific situation, particularly if you have complex trades, stock options, or multi-state tax obligations.