Calculate capital gains after a partial stock sale
For shares sold, subtract the adjusted basis of those specific shares and applicable selling costs from the amount realized.
More key points
- When shares were purchased in different lots, identify which lot was sold; holding period and per-share basis can differ.
- If shares are not adequately identified when required, the tax rules may apply a default method such as first-in, first-out.
On this page9 sections
Selling only part of a stock position does not mean dividing the account's total basis by its current market value. A taxable gain or loss is calculated on the particular shares disposed of. If the investor bought shares on different dates or at different prices, the selected tax lot controls both basis and holding period. Check the lots.
The calculation
For the shares sold, amount realized is generally the proceeds after applicable selling costs. Subtract the adjusted basis of those shares to calculate gain or loss. In compact form: amount realized − adjusted basis = gain or loss. The capital gain holding period is generally measured for the sold shares from acquisition to disposition; a position can contain both short-term and long-term lots.
Worked example with identified lots
An investor owns 100 shares bought in an earlier lot for $20 each and 50 shares bought later for $35 each. The investor sells 60 shares for $30 each and adequately identifies 10 of the $20 shares and all 50 of the $35 shares. Proceeds are $1,800. Basis is $200 for the first lot plus $1,750 for the second lot, or $1,950. Before selling costs and other adjustments, the realized loss is $150.
If instead 60 of the older $20 shares were sold, basis would be $1,200 and proceeds $1,800, creating a $600 gain before costs. The share price at sale is the same in both examples. The tax result changes because a different lot was disposed of.
Specific identification and FIFO
Specific identification means directing the broker to sell particular shares and receiving confirmation that the instruction was carried out. The taxpayer's records should tie the sale to those acquisition lots. Simply deciding after the sale which shares would produce a preferred tax result is not the same as identifying them at the time of sale.
When the shares sold are not adequately identified, the IRS generally applies first-in, first-out (FIFO) for stock held in an account, subject to the applicable account and reporting rules. Under FIFO, the earliest acquired shares are treated as sold first. Do not assume average basis applies to ordinary individual shares; average-basis elections are available only for certain investments and situations under specific rules.
Track each lot's holding period
The same sale can include both short-term and long-term shares. A lot held for one year or less is generally short term; a lot held for more than one year is generally long term. Keep the acquisition date with each lot and classify the gain or loss lot by lot before applying the Schedule D netting rules. Do not assign the oldest holding period to every share in the account.
Basis adjustments and wash sales
Adjusted basis can differ from the purchase price because of corporate actions, reinvested distributions, or other tax adjustments. A stock split changes per-share basis while generally preserving the lot's total basis. If the sale realizes a loss and substantially identical shares are purchased within the wash-sale window, some or all of the loss may be disallowed and added to the replacement shares' basis. Apply those rules after identifying which shares were sold; see the wash-sale discussion for the full window and IRA consequence.
A reliable exam sequence
- Read how many shares were sold and whether the prompt specifies which lot.
- Match sold shares to lot-specific acquisition dates and adjusted per-share basis.
- Calculate the amount realized and basis for only those shares.
- Find gain or loss, then classify each lot as short term or long term.
- Check the question for selling costs, basis adjustments, corporate actions, or a wash sale before netting amounts.
The frequent error is applying the entire account's average purchase price without checking the lot rule. Separate the shares first, calculate each lot's result, and combine only after the holding periods and adjustments are clear. Calculate separately.
Match each sold share to a lot
A partial sale does not automatically use the average cost across every purchase. Each purchase lot can have a different adjusted basis and holding period. If the broker permits specific identification, the taxpayer should identify the shares at the time of sale and obtain confirmation that the broker recorded the instruction. If shares are not adequately identified, the default ordering rule—often FIFO—can determine which lot is treated as sold.
Example: an investor bought 100 shares at $20, then 100 at $35. The investor sells 80 shares at $50 and identifies the $35 lot. Proceeds are $4,000; basis is $2,800; gain before selling costs is $1,200. If FIFO applies instead, basis would be $1,600 and gain would be $2,400. The lot selection changes gain and holding period, so the records matter.
Adjust basis and holding period correctly
Basis may change for commissions, reinvested dividends, stock splits, return of capital, wash-sale adjustments, gifts, inheritances, and corporate actions. A reinvested dividend generally creates a new lot with its own basis and acquisition date. A wash sale can defer a loss by adding it to replacement shares’ basis under applicable rules. Reconcile Form 1099-B with the taxpayer’s records rather than assuming broker basis is always complete.
The holding period generally begins the day after acquisition and ends on the sale date. Shares held more than one year are generally long-term; one year or less is short-term. Different lots in the same sale can produce both character types. Identify the lot first, then compute basis and holding period. Do not use the date the client opened the brokerage account as the start date for every share.
Report and review before harvesting losses
Form 8949 reports sales and adjustments, while Schedule D nets capital gains and losses. A broker may report basis to the IRS for covered shares, but noncovered securities, gifts, inherited assets, and corporate actions may require client records. Correct erroneous basis rather than accepting a misleading gain. Selling costs generally reduce amount realized where properly allocable.
Tax-loss harvesting should consider wash-sale rules across accounts and spouses, replacement investments, transaction costs, and the client’s target allocation. A tax benefit may be delayed rather than permanent if the loss is added to replacement basis. For exam questions, list acquisition lots, determine the shares sold, calculate proceeds minus adjusted basis, and classify short- or long-term. Then apply the netting rules separately.
Common questions
How do I calculate gain when I sell only some of my shares?
Subtract the adjusted basis of the specific shares sold from the amount realized on those shares. Keep basis and holding period tied to the selected tax lot.
Can I choose which stock shares I sell for tax purposes?
Specific identification may be used when the shares are adequately identified to the broker at the time of sale and confirmation is received. The applicable default method applies when shares are not adequately identified.
What does FIFO mean for stock tax lots?
First-in, first-out generally treats the earliest acquired shares as the shares sold when the taxpayer has not adequately identified which shares were disposed of, subject to applicable rules.
Can one stock sale have both long-term and short-term gains?
Yes. If the sale includes lots acquired on different dates, calculate each lot's result and holding period separately before combining them.
Does a wash sale change the initial gain calculation?
First calculate the result for the identified shares. If the sale creates a loss, then check whether replacement purchases trigger wash-sale treatment and adjust the loss and replacement basis as required.
How do I calculate gain on a partial stock sale?
For the identified shares, subtract their adjusted basis and allocable selling costs from the amount realized.
What if the investor does not identify lots?
A default method such as FIFO may apply under the account and tax rules; verify broker records and current IRS procedures.
Can one partial sale have both short- and long-term gains?
Yes. Different lots sold in the same transaction can have different acquisition dates and tax character.