Most of us are aware that you have to net out your capital gains and losses when figuring your taxes for the year. But how does all this netting work? Should I be hanging around the local dock to learn how to net my capital gains and losses? Let's try to unravel some of this mystery.

First, there are a couple of levels of netting. Long-term items are netted separately from short-term items. Then, the long and short are netted together to produce the final result. It's easiest to just look at an example.

Suppose that Long John Silver sold two stocks so far this year. Both were held for more than a year, so they are long-term items. Long John had a gain of $1,000 on his investment in Fishing.com -- an Internet startup selling trout and salmon online to unlucky fishermen -- but a $600 loss on Fish-R-Us, a retailer of fish-shaped toys for kids. Subtract the loss from the gain, and we find that he has a net $400 long-term gain.

Now, let's say that he sells two more stocks before year's end. His investment in Mackerel Industries has turned out to be a real stinker. So he unloads it for a $300 short-term loss. And Minnow, Inc., turned a small short-term gain of $50. Net these two items together, and Long John has a $250 short-term loss.

Finally, we net the short-term items with the long-term items and find that Long John has a net $150 long-term gain.

If you think about it for a while, you'll find that everything will boil down to one of four situations:

- long-term gain with short-term gain
- long-term loss with short-term gain
- long-term gain with short-term loss
- long-term loss with short-term loss

Let's look at each of these situations.

**Long-term gain with short-term gain**Ahhh -- investment nirvana! Everything nets out to a winner. Your taxes here are pretty simple. (Don't worry, though; they'll get more challenging as we go along.) The long-term gain gets the preferential rate of 10% or 20%, depending on your tax bracket. The short-term gain is taxed with your other income at your marginal rate.

**Long-term loss with short-term gain**We have to look at two situations here. If the gain is bigger than the loss, you have a net short-term gain -- taxed at your marginal rate. If the loss is bigger, you have a net long-term loss. Up to $3,000 can be used to offset other kinds of income. Any unused amount will carry forward to the following year as a long-term loss.

**Long-term gain with short-term loss**Again we have to consider two scenarios. If the gain is bigger than the loss, you have a net long-term gain and get to take advantage of the favorable rates for the net gain. If the loss is larger, it is a net short-term loss. Just like the previous situation, you can use up to $3,000 of that loss against other types of income, with any balance carrying forward to the next year as a short-term loss.

**Long-term loss with short-term loss**Have you ever considered index funds? This one looks simple, but there's a twist. By now, you know that a maximum of $3,000 in losses will offset ordinary income. So, if the total of the two losses is less than $3,000, you're done. But what if the total loss is more than $3,000 and some must be carried over to next year? Is the carryover short-term or long-term? Well, it can be just long-term, or a combination of long- and short-term. But it will never be just short-term. Why? Because you must use the short-term losses first.

If your short-term losses are more than $3,000, you use the first $3,000 to offset ordinary income, then carry the remaining short-term loss along with all of the long-term loss over to next year. If the short-term loss is less than $3,000, you can just total the two losses together, take the $3,000 off, and the balance is a long-term loss carryover to the following year.

So, the process for determining the long-term or short-term character of your capital gains and losses can be summarized in three steps:

- Net your long-term items together.
- Net your short-term items together.
- Determine which of the above four situations applies to you, and follow the instructions there.

But what if you don't have any of one type of transaction -- either short-term or long-term? (Or, in a really unlikely situation, your long-term or short-term gains or losses net out to exactly zero?) The above instructions still work. Just consider the missing item to be a gain, and follow the same steps.

**For more on the taxes that affect investors, read about:**

- How 60 seconds can teach you the basics of taxes on investors.
- How to calculate your holding period for stocks and funds.
- What the wash sale rule is and how to deal with worthless stock.
- Why you have to pay attention to special tax rules for mutual funds.
- How to keep the tax man at bay.