Investors have had plenty of nightmares over the past year as they've watched their portfolio values plunge. To keep from experiencing yet another nightmare next April, though, you can take steps now to keep your taxes simple while letting you make the most of the losses you've suffered.

As we approach the last week of the year, time's running out if you want to sell investments to harvest tax losses. If you just hit the sell button without considering all of the choices you have with your tax-loss selling, you could create a big headache for yourself -- one that you could have avoided.

The ways to account for sales
In accounting for sales of investments, you have to figure out how much gain or loss you have on your position. That number, in turn, depends on the cost basis of the shares you sold.

If you sell all of your shares, then your basis is just the total amount you paid for the shares, including any commissions. If you get less than that amount when you sell, you have a loss; if you get more, then you have a gain.

Where it gets tricky, though, is when you sell only part of your holdings. Then, you have several choices to determine cost basis:

  • The default method is to look at the shares you bought first and take what you paid for them as your cost basis.
  • However, you can also specifically identify shares when you sell them, which lets you sell shares you bought later if you want.
  • With mutual funds, you can also use one of two average cost methods, in which you divide the number of shares you bought over time by the total of what you paid for them.

Sound easy? It's not -- especially if your broker isn't totally cooperative with great record-keeping.

What's at stake
But it's still worth the extra effort to look over all of your options. If you regularly invest and have bought shares of the same stock or mutual fund at various times, picking the right method can save you thousands on your taxes. You might have gains on long-held shares but losses on others. If you're not careful, you could turn your intended tax loss into a gain.

For instance, if you bought shares of the following stocks five years and one year ago, you'd be much better off selling the shares bought one year ago:

Stock

5-Year Average Return

1-Year Total Return

Apple (NASDAQ:AAPL)

54%

(55.8%)

Caterpillar (NYSE:CAT)

2%

(41%)

Dominion Resources (NYSE:D)

5.4%

(26%)

Kimberly-Clark (NYSE:KMB)

1.4%

(21.4%)

Lockheed Martin (NYSE:LMT)

11.4%

(27.2%)

Monsanto (NYSE:MON)

37.8%

(40%)

Teva Pharmaceutical (NASDAQ:TEVA)

9.1%

(6.4%)

Source: Yahoo! Finance as of Dec. 22.

Unfortunately, you can't go back after the fact and pick shares to sell. Instead, you need to tell your broker up front which shares to sell and ideally get written confirmation that your broker followed those instructions.

Funds and average cost
With mutual funds, you have another choice: You can use one of two average cost methods. With one, you look at all your shares. With the other, you divide your shares into long-term (more than a year) and short-term holdings and then do separate averages for each.

One advantage of average cost is that many fund companies provide this information to you on your year-end tax forms. Given how hard it is to keep track of all the fractional shares involved with purchases and reinvested dividends, your fund company can be a lifesaver at tax time.

However, you may still be better off specifically identifying shares. If so, the rules for identifying shares are the same as for stocks -- get written confirmation from your fund company of the shares you choose.

In addition, once you pick an average cost method for a fund, you have to keep using that method in future years. So be sure you're ready to commit before you use either method.

Be tax-smart
Dealing with tax issues intimidates even the most experienced investors. With a little basic knowledge, though, you can take maximum advantage of the rare benefits the tax code gives investors.

For more on dealing with the bear market:

Tax questions? Our Rule Your Retirement newsletter service has the answers you need on the tax matters that matter most to retirees and aspiring career savers alike. You'll get helpful reminders about tax deadlines, along with more information on tax breaks. See everything Rule Your Retirement has to offer with a free 30-day trial.

Fool contributor Dan Caplinger has a ridiculously complicated spreadsheet to track his investments. He doesn't own shares of the companies mentioned in this article. Kimberly-Clark is a Motley Fool Income Investor recommendation. Apple is a Stock Advisor selection. Try any of our Foolish newsletter services free for 30 days. The Fool's disclosure policy wishes you sweet dreams.