Pomegra Wiki

How to Calculate Capital Gains on a Stock Sale

The gain on a stock sale is simply proceeds minus adjusted cost basis, classified as short-term or long-term based on your holding period. Dividends complicate the picture slightly—they raise your basis if reinvested, and stock splits reset your per-share cost. Once you know your basis and your net proceeds, you plug the numbers into the standard gain formula.

The Basic Calculation: Proceeds Minus Basis

The foundation of any capital gains calculation is straightforward: subtract what you paid from what you received. If you bought 100 shares at $50 per share and sold them all at $75, your proceeds are $7,500. Your original cost basis is $5,000. The capital gain is $2,500.

In practice, “proceeds” means the sale price per share times the quantity sold, minus broker commissions and any trading fees. “Cost basis” is not simply your purchase price—it’s your adjusted basis, which reflects changes to your ownership claim over time. The most common adjustments are dividend reinvestment, stock splits, and distributions.

Adjusted Basis: How Dividends and Splits Change What You Owe

Dividend reinvestment raises your basis. If you own shares that pay a dividend, and you reinvest that dividend to buy more shares at the then-current price, you have now purchased additional shares at a different cost per share. Those new shares have their own basis (the dividend amount divided by the share price at reinvestment). When you eventually sell, you must account for all shares at their respective adjusted bases.

Stock splits and reverse splits reset your per-share basis. A 2-for-1 split halves your per-share cost; a 1-for-2 reverse split doubles it. The total basis doesn’t change—it’s just allocated differently.

Consider a concrete example:

  • You buy 100 shares at $50 = basis of $5,000.
  • You receive a $2 per-share dividend = $200 total; you reinvest it at $60 per share, buying about 3.33 more shares.
  • The 3.33 shares have a basis of $200.
  • Your total basis is now $5,200 across 103.33 shares.
  • When you sell all 103.33 shares at $75, proceeds are $7,749.75, and your gain is $7,749.75 − $5,200 = $2,549.75.

Many brokers now report this automatically on Form 8949, but you should verify it, especially if you’ve held the shares for many years and have had multiple reinvested distributions.

Short-Term vs. Long-Term Holding Period

The holding period determines your tax rate. You must hold the shares for more than one year (not one year exactly—the rule is over one year) to qualify for long-term capital gains treatment.

The holding period starts the day after you purchase and ends on the day you sell. So if you buy on January 10, 2024 and sell on January 10, 2025, you’ve held for exactly one year, which does not qualify as long-term; you need to wait until January 11 to cross the one-year threshold.

Short-term gains are taxed as ordinary income at your marginal rate, which can be 10%, 12%, 22%, 24%, 32%, 35%, or 37% (U.S. federal). Long-term gains are taxed at preferential rates: 0%, 15%, or 20%, depending on your income level and filing status.

A simplified rule: if your income places you in the 10% or 12% bracket, long-term gains are taxed at 0%. If you’re in the 22%, 24%, 32%, or 35% bracket, long-term gains are taxed at 15%. If you’re in the top 37% bracket, long-term gains are taxed at 20%. These thresholds shift annually with inflation.

The tax difference is substantial. A $10,000 short-term gain in the 24% bracket costs $2,400; the same gain taxed as long-term (at 15%) costs $1,500.

Handling Multiple Transactions and Identification

If you’ve bought the same stock at different times and prices, and you want to sell some but not all, you must specify which shares you’re selling. This is the specific identification method—you select which lot of shares, at which purchase price, you’re liquidating.

Suppose you bought 50 shares at $40 and 50 shares at $60, and the stock now trades at $80. If you sell 50 shares without specifying, the default is usually FIFO (first-in, first-out)—you sell the $40 lot first, realizing a $2,000 gain per 50 shares. But if you specify that you’re selling the $60 lot, you realize a $1,000 gain, saving $150 in taxes (at the 15% long-term rate). You must elect specific identification in writing to your broker before or at the time of sale.

Other methods include LIFO (last-in, first-out) and average cost. Each has different tax implications depending on your situation and your holding periods.

Reinvested Dividends and Long-Term Holding

A common mistake: reinvested dividends do not extend your holding period for the original shares. If you buy a stock on January 10, 2024 and reinvest dividends throughout 2024 and 2025, those reinvested shares have their own separate holding periods, starting on the date you reinvested.

When you sell your original lot on January 11, 2025, it qualifies for long-term treatment. But the shares you bought via dividend reinvestment on, say, March 15, 2024, qualify as long-term on March 16, 2025. This matters if you’re selling in stages or if you’re using specific identification.

Losses and Loss Harvesting

The same formula works in reverse. If you sell at a loss, the loss is the absolute value of your negative gain. A sale at a $1,500 loss is reported as a capital loss.

Short-term losses can offset short-term gains and long-term gains dollar-for-dollar. Long-term losses offset long-term gains first, then short-term gains. Once losses exceed gains in a year, the net capital loss is limited to $3,000 in deductions against ordinary income; any remaining loss is carried forward indefinitely.

This asymmetry is the basis of tax-loss harvesting—timing sales to realize losses in high-income years and deferring gains to lower-income years.

Special Cases: Mutual Fund Distributions and Wash Sales

Mutual fund distributions are treated like dividends—they raise your basis if reinvested, or they’re taxable income if taken in cash. Some funds distribute long-term capital gains directly to shareholders; if you receive such a distribution, it’s taxable as a long-term capital gain, even if you haven’t held the fund long.

The wash-sale rule complicates losses. If you sell shares at a loss and buy the same or substantially identical stock within 30 days before or after the sale, the loss is disallowed, and the loss amount is added to the basis of the new shares instead. This rule prevents you from harvesting a loss while immediately re-establishing your position.

See also

  • Cost basis — the foundation of your purchase price before adjustments
  • Form 8949 — IRS form for reporting gains and losses
  • Tax-loss harvesting — using losses to offset gains and ordinary income strategically
  • Long-term capital gain tax (investor) — preferential tax rates for qualifying holds
  • Wash sale — the rule preventing you from immediately rebuying after a loss
  • Capital gains tax (investor) — overview of short-term and long-term treatment

Wider context