How Do Short-Term and Long-Term Capital Gains and Losses Get Netted Together?
Selling several investments in the same year rarely produces one clean number. Each sale generates its own gain or loss, and before any of it shows up as taxable income, it has to move through a specific sequence of combining and offsetting steps.
The short answer
Capital gains and losses are first sorted into short-term and long-term categories, netted against each other within each category, and then netted between the two categories to arrive at a single net short-term or net long-term result. Only after that combined process is complete does the remaining amount get taxed or, if it’s a loss, applied against other income within its annual limit.
Step one: sort every trade into a category
Every sale of a capital asset during the year gets classified as either short-term (generally held one year or less) or long-term (generally held more than one year), based on the holding period. This sorting happens trade by trade, so a single account can easily produce a mix of both categories in the same year — a stock held for eight months sold at a gain sits in a different bucket than a fund held for three years sold at a loss.
Step two: net within each category first
All the short-term gains and losses are added together to produce one net short-term figure, and separately, all the long-term gains and losses are added together to produce one net long-term figure. At this stage, a large short-term loss can fully offset a large short-term gain, but it hasn’t yet touched anything in the long-term column, and vice versa.
Step three: net the two categories against each other
If both categories land as gains, they’re simply reported as a net short-term gain and a net long-term gain, which matters because the two are often taxed differently. But if one category is a net loss and the other is a net gain, the loss category offsets the gain category — a net short-term loss reduces a net long-term gain, and the reverse also happens when a net long-term loss exists alongside a net short-term gain. This step is where the difference between short-term and long-term capital gains tax treatment becomes most visible, since which category absorbs the offset can shift how much ends up taxed at more favorable long-term rates.
What happens if the combined result is a loss
If, after all that netting, the overall result is a net capital loss, it can be used to offset other income, but only up to the annual limit that applies to capital losses against ordinary income. Anything beyond that limit doesn’t disappear — it carries forward as a capital loss carryover to future years, where it goes through this same netting process again alongside whatever new gains and losses show up. This layered netting structure is also the mechanical foundation behind tax-loss harvesting, which intentionally realizes losses to offset gains elsewhere in a portfolio.
Why the order matters more than people expect
It’s tempting to think of gains and losses as just adding and subtracting into one final number, and mathematically the end result is the same either way. But the category-by-category process matters for record-keeping and for understanding tax exposure, since a portfolio with lots of short-term trading activity can end up with a very different mix of net short-term versus net long-term results than the raw total dollar gain or loss might suggest. Reviewing a year-end brokerage summary with this structure in mind, rather than just looking at the bottom-line number, tends to make the eventual tax outcome much less surprising.
The bottom line
Netting capital gains and losses is a layered process — first within each holding-period category, then between categories — before any limit on offsetting other income even comes into play. Understanding that sequence helps explain why two people with the same total gain for the year can end up with meaningfully different tax outcomes depending on the mix of trades behind that number.