Trading Guides
Tax-loss harvesting: how it works, the wash sale rule and year-end timing
Updated
Tax-loss harvesting means selling an investment that has fallen below what you paid, so the loss can offset capital gains on your tax return. Under US rules, losses first reduce gains, then up to $3,000 a year of any remaining net loss can reduce other income, and the rest carries forward. This guide explains the rules; it is not tax advice, and your own situation needs a tax professional.
How capital losses reduce your tax
When you sell an investment for more than its cost basis, usually what you paid, you have a capital gain. When you sell for less, you have a capital loss. According to IRS Topic 409, the holding period decides the type: more than one year is long-term, one year or less is short-term. Net short-term gains are taxed as ordinary income, while net long-term gains usually get lower rates.
Losses are netted against gains. If your losses are larger than your gains for the year, the IRS lets you deduct the smaller of $3,000, or $1,500 if married filing separately, and your total net loss. Any loss above that limit carries forward to later years. That carryforward is the reason a harvested loss can still be useful in a year with no gains.
The wash sale rule: the 30-day window
The rule that most often undoes tax-loss harvesting is the wash sale rule. As the SEC's Investor.gov explains it, a sale at a loss is a wash sale if, within 30 days before or after the sale, you:
- buy substantially identical securities,
- acquire substantially identical securities in a fully taxable trade, or
- acquire a contract or option to buy substantially identical securities.
IRS rules prohibit deducting a loss from a wash sale. Because the window runs both before and after the sale, it covers about two months in total. Purchases you did not think of as trades still count, such as automatic dividend reinvestment into the same shares. Shares of the same company are clearly substantially identical. Whether two different funds are depends on the facts, so check with a tax professional before swapping one fund for a similar one.
Timing: why harvesting is a year-end habit
Gains and losses count in the tax year in which you sell. Reviewing your positions in November leaves time to act before December 31 without rushing into trades in the last days of the year, when many other investors are doing the same thing. Some investors also review after any sharp market fall, when losses are largest.
Plan the 30-day window at the same time. If you sell a fund on December 10 and still want that market exposure, decide in advance whether you will hold cash, hold a fund that is clearly different, or wait until the window has passed before buying back.
A worked example
Say that earlier in the year you sold one stock for a $5,000 short-term gain. Another holding now shows a $7,000 loss. If you sell it, the $7,000 loss offsets the $5,000 gain and leaves a $2,000 net loss, which is under the $3,000 limit, so all of it can reduce your other income this year.
Now change one number: the holding shows a $10,000 loss. Netting leaves a $5,000 loss. You can deduct $3,000 this year and carry $2,000 forward. In both cases the loss only counts if you avoid buying the same shares back inside the 30-day window. The tax saved depends on your bracket, so the example stops at the deduction.
A checklist before you sell
- Confirm the position sits in a taxable brokerage account, where gains and losses are reported each year. Harvesting does nothing inside an account where they are not.
- Check the holding period, so you know whether the loss is short-term or long-term.
- Look back 30 days for any purchase of the same shares, and switch off dividend reinvestment for that holding before you sell.
- Decide in advance what you will hold during the window, and write the date it ends.
- Keep the trade confirmation and your broker's year-end tax form, and give both to whoever prepares your return.
Crypto and other assets
For US tax purposes, the IRS treats digital assets such as cryptocurrency as property, not currency, so selling them can create capital gains and losses too. Brokers now report digital asset sales on Form 1099-DA for transactions from January 1, 2025. Whether the wash sale rule applies to a particular digital asset depends on how the law treats that asset, and rules in this area have been changing, so check current IRS guidance before planning a crypto harvest.
Mistakes that undo the benefit
- Buying the same shares back within 30 days, directly or through dividend reinvestment.
- Selling a position you still believe in only for the tax, then missing the recovery.
- Leaving the portfolio badly unbalanced while you wait out the window.
- Ignoring trading costs and spreads, which can eat a small tax saving.
- Applying US rules to an account in another country; other tax systems have their own rules.
Tax-loss harvesting is a tool for keeping more of what a portfolio earns. It should not be the reason a trade exists.
Outside the US: the UK, Spain, Brazil, Mexico and the UAE
The wash sale rule is American. Other countries have their own rules for selling at a loss and buying back, and they are not the same. These are the main ones, from each tax authority's own guidance; a local tax adviser should confirm how they apply to you.
- United Kingdom. There is no rule called a wash sale, but HMRC matches every sale of shares in a particular order: first with shares of the same company bought the same day, then with shares bought in the 30 days after the sale (the "bed and breakfasting" rule, for UK residents), and only then with your pooled holding. Selling and buying back within 30 days therefore ties the sale to the new purchase price. Gains are only taxed above the annual exempt amount, which is £3,000.
- Spain. The Agencia Tributaria does not count a loss on listed shares or funds if you bought homogeneous securities in the two months before or after the sale; for unlisted ones the window is a year. The loss is not lost, only deferred until you sell the securities you still hold.
- Brazil. The Receita Federal lets stock market losses offset gains in the same month or later months, never earlier ones, and day-trade losses only offset day-trade gains. Losses from earlier periods must be reported in your annual return to be used.
- Mexico. Gains on shares sold through the stock exchange follow the Mexican income tax law; check the SAT's current rules before planning a harvest.
- United Arab Emirates. The UAE does not levy income tax on individuals, so a loss harvested there saves no UAE tax. If you are also taxed by another country, its rules decide.
The lesson is the same in every country: a sale made for tax reasons only works if you know your own country's buy-back window before you sell.
How Astra fits
Astra does not give tax advice and does not place orders. If you bring a harvesting idea to the desk, Quill drafts the plan with the sale, the 30-day window and what to hold in the meantime, Aegis checks whether the remaining portfolio stays within your limits during the window, and Cassandra asks whether the position deserves to be sold on its own merits. You then take the plan, and your questions about tax, to your broker and a tax professional.
Sources
Frequently asked questions
What is tax-loss harvesting?
It is selling an investment at a loss so the loss can offset capital gains on your tax return. Under US rules, net losses beyond your gains can reduce other income by up to $3,000 a year, and the rest carries forward.
How much can I deduct from capital losses?
Under IRS rules, the lesser of $3,000 ($1,500 if married filing separately) or your total net capital loss each year. Any excess carries forward to later years. This is not tax advice.
What is the wash sale rule?
If you sell at a loss and, within 30 days before or after, buy substantially identical securities or an option to buy them, the loss is not deductible. Automatic dividend reinvestment can trigger it too.
When should I do tax-loss harvesting?
Many investors review in November so they can act before December 31 without rushing, and also after a sharp market fall. Plan the 30-day window before you sell.
Is there a wash sale rule in the UK or Spain?
Not by that name. In the UK, HMRC matches a sale with shares bought the same day, then with shares bought in the following 30 days. In Spain, a loss on listed shares is deferred if you bought homogeneous securities within two months before or after the sale.
Astra is not affiliated with eToro, Interactive Brokers, or moomoo. Product names are used only to describe publicly available features. This is educational content, not investment advice. Trading involves risk of loss.