To reduce capital gains tax when you sell part of a stock or fund position, use the specific identification method to choose which tax lot leaves the account: pick the lot with the highest cost basis (or a lot sitting at a loss), tell your broker before the trade settles, and keep the written confirmation. Learning how to sell in tax lots to reduce capital gains tax comes down to that decision, made deliberately, every time you place a partial sell order.
Every purchase you make creates a separate tax lot with its own purchase date, price per share, and cost basis.1Office of the Law Revision Counsel. 26 USC 1012 – Basis of Property-Cost Buy 50 shares in January and 50 more in June, and you own two lots. Reinvested dividends create their own lots too, so a stock held for years through a DRIP can quietly accumulate dozens of small lots at different prices. When you sell fewer shares than you own, the specific lot that gets sold determines the gain or loss you report.
Why the Lot You Choose Changes Your Tax Bill
Two features of each lot drive the tax outcome: its cost basis and how long you’ve held it.
Cost basis is what you paid, including any commission or transfer fee folded into the purchase.2Internal Revenue Service. Publication 551 – Basis of Assets The higher the basis, the smaller the gain on a sale at any given price. Selling a lot bought at $80 when the stock is at $45 produces a $35-per-share loss; selling a lot bought at $30 produces a $15-per-share gain. Same trade price, opposite tax result.
Holding period sets the rate. Shares held one year or less produce short-term gains taxed at ordinary income rates, potentially as high as 37%. Shares held more than a year qualify for long-term rates of 0%, 15%, or 20%, depending on your taxable income.3Office of the Law Revision Counsel. 26 USC 1222 – Other Terms Relating to Capital Gains and Losses4Internal Revenue Service. Topic No. 409, Capital Gains and Losses Higher earners also pay a 3.8% net investment income tax on capital gains once modified AGI passes $200,000 for single filers or $250,000 for joint filers.5Internal Revenue Service. Net Investment Income Tax
That gap matters at the moment of sale. A lot held for 11 months and one held for 13 months at the same profit can be taxed at wildly different rates. If you have older lots available, favoring those over recently purchased ones preserves long-term treatment.
The Lot Selection Methods Your Broker Offers
When you place a partial sell order, the brokerage applies a cost basis method to decide which shares are sold. The method controls the tax result.
First-In, First-Out
FIFO sells your oldest shares first. It is the default at most brokerages, which means if you give no instruction, this is what happens. FIFO helps when your oldest shares carry the highest basis. It hurts when those oldest shares were bought cheaply years ago and have appreciated the most, because it produces the largest possible gain.
Specific Identification
Specific identification is the method that actually reduces your tax bill by design. You tell the broker exactly which lot to sell, identified by purchase date and price. Federal regulations require the identification to be made no later than the settlement date and confirmed in writing by the broker.6eCFR. 26 CFR Part 1 – Basis Rules of General Application This is the method to use when you care about the outcome of an individual trade.
Highest-In, First-Out
HIFO automatically sells the lot with the highest basis. Because higher basis means smaller gain or larger loss, HIFO tends to minimize the tax on any given sale. Some brokerages offer it as a standing account-level default, which is essentially specific identification on autopilot.
Average Cost (Mutual Funds Only)
For mutual fund shares and DRIP shares acquired after 2011, you can elect the average cost method, which pools every share into a single averaged basis. The election must be made in writing to the fund custodian, and once you sell shares using average cost, you’re locked into it for that account until you revoke it in writing. Average cost simplifies bookkeeping but eliminates lot-by-lot choice. If you want to actively manage your tax exposure on mutual fund shares, specific identification is available and usually the better call.7Internal Revenue Service. Publication 550 – Investment Income and Expenses Average cost does not apply to individual stocks or ETFs.
Placing the Sale and Meeting the Deadline
The mechanics happen inside your brokerage’s trading screen. When entering the sell order, look for the cost basis option and either select the specific lot or confirm the method the account uses. The legal deadline for identifying which shares you sold is the settlement date.6eCFR. 26 CFR Part 1 – Basis Rules of General Application Since the market moved to T+1 settlement in May 2024, that gives you one business day after the trade.8U.S. Securities and Exchange Commission. SEC Chair Gensler Statement on Upcoming Implementation of T+1 Miss it and the default method applies. You cannot change it after the fact.
The safer habit is to pick the lot when you place the order. Waiting until the next day to call and specify shares is allowed but risks the deadline.
A standing instruction to your broker (for example, “always sell the highest-cost lot first”) counts as adequate identification made at the time of sale, so you don’t have to re-select on every trade.6eCFR. 26 CFR Part 1 – Basis Rules of General Application After the trade, save the confirmation showing which lot was sold. That confirmation is your evidence if the IRS ever questions the basis you reported.
Using Lot Selection to Harvest Losses
Lot selection turns the same position into a source of tax savings when parts of it are underwater. Sell the lots at a loss, keep the winners, and use the realized loss to offset gains elsewhere in the portfolio.
If total capital losses exceed total capital gains for the year, you can deduct up to $3,000 of the excess against ordinary income ($1,500 if married filing separately). Unused losses carry forward indefinitely until absorbed.9Office of the Law Revision Counsel. 26 USC 1211 – Limitation on Capital Losses
Consider 300 shares of the same stock held across three lots at $80, $50, and $30, with the stock now trading at $45. Specific identification of the $80 lot realizes a $35-per-share loss. Under FIFO, if the $30 lot came first, the same sale realizes a $15-per-share gain instead. The strategy only works if you name the lot.
The Wash Sale Rule
The main trap when harvesting losses is the wash sale rule. The IRS disallows a loss if you buy substantially identical shares within 61 days: the 30 days before the sale, the day of the sale, and the 30 days after.10Office of the Law Revision Counsel. 26 USC 1091 – Loss From Wash Sales of Stock or Securities The rule reaches across all your accounts, including your IRA and your spouse’s accounts. Reinvested dividends inside that window can trigger it without you noticing.
The disallowed loss isn’t gone. It gets added to the basis of the replacement shares. If you sold at a $1,000 loss and bought 100 replacement shares for $4,000 inside the window, the new lot’s basis is $5,000.10Office of the Law Revision Counsel. 26 USC 1091 – Loss From Wash Sales of Stock or Securities You recover the benefit when you eventually sell the replacement, assuming you don’t trip the rule again.
To harvest cleanly, wait at least 31 days before repurchasing, or buy something similar but not substantially identical (for example, swapping one S&P 500 index fund for a total stock market fund from a different provider). Whether two securities are substantially identical is a facts-and-circumstances judgment.
Lots With Unusual Basis
Not every lot comes from a straightforward purchase, and the odd ones have their own basis rules.
Inherited shares. Basis resets to the fair market value on the date the original owner died, regardless of what they paid.11Office of the Law Revision Counsel. 26 USC 1014 – Basis of Property Acquired From a Decedent Selling inherited shares soon after receiving them often produces little or no gain, which is worth checking before you spend time picking among lots.
Gifted shares. Basis carries over from the donor with no step-up.12Office of the Law Revision Counsel. 26 USC 1015 – Basis of Property Acquired by Gifts and Transfers in Trust If the fair market value at the time of the gift was lower than the donor’s basis and you later sell at a loss, your basis for calculating that loss is the value at the time of the gift, not the donor’s higher figure.
Stock splits. A split multiplies your share count and divides your per-share basis. Total basis is unchanged: 100 shares at $15 becomes 200 shares at $7.50 after a 2-for-1.13Internal Revenue Service. Stocks (Options, Splits, Traders) 7 Brokers handle this for covered securities, but it’s worth verifying the lot records look right afterward.
Reinvested dividends. Each reinvestment is its own lot. A decade of quarterly reinvestments can leave you with 40 or more small lots at different prices. Some of them may be sitting at a loss even when the overall position is up, which makes them useful harvesting targets.
Records You Need Before Selling
Picking the right lot requires knowing the date, price, and share count of every lot you own. For covered securities (generally shares purchased after 2011), your broker tracks this and reports it on Form 1099-B.14Internal Revenue Service. About Form 1099-B, Proceeds From Broker and Barter Exchange Transactions
For older holdings and shares transferred in from another brokerage, the basis in your current broker’s system may be incomplete or missing, and the burden of proving basis falls on you.7Internal Revenue Service. Publication 550 – Investment Income and Expenses Track down old trade confirmations, account statements, or DRIP records before you sell. If you can’t establish basis, the IRS may treat it as zero, and the entire sale proceeds become taxable gain.
Reconcile the broker’s reported basis against your own records, especially for noncovered lots where the 1099-B says “basis not reported to the IRS.” Those are the lots where mistakes are easiest to make and hardest to fix after the fact.