Update: Since this article was originally published, new legislation requires that mutual fund providers calculate -- and report to the IRS -- the cost basis for all mutual fund shares purchased after Jan. 1, 2012. Investors can choose from a minimum of three cost basis accounting methods. For mutual fund shares purchased prior to 2012, the article below still serves as a guide to selecting the appropriate, historic cost basis method. To stay abreast of the latest developments in mutual fund cost basis methods, we recommend bookmarking this Wikipedia page.

NEW YORK ( TheStreet) -- Taking your money out is supposed to be the easy part. But for many mutual fund investors, that's when the headache begins.

Selling mutual fund shares requires a fair amount of organization and planning -- especially if you want to optimize the resulting tax situation. Whenever you sell shares in a mutual fund, you'll generate a capital gain or loss that must be reported to the Internal Revenue Service.

Even if you move money from one fund into another in what seems like a single, seamless transaction, a taxable event still has occurred. You'll owe tax (or can claim a loss) on the sale, and the amount you transfer to another fund will serve as the initial cost basis for that fund.

Determining the cost basis of your shares can be a tricky business, though. But no matter how frustrating the process seems, it's a crucial step.

Defining Cost Basis

The cost basis is the amount of money you've invested in your shares -- any amount above the cost basis is your gain. Basis is essentially the money you plunked down to buy the initial shares, but it also includes sales charges and redemption fees you paid for the share upon purchase or sale. (If you're selling shares and moving the proceeds into a different fund in the same family with a reduced load charge, you must have held the shares for more than 90 days to include the load charges in the basis.)

You should also include in the cost basis any dividends or capital gains distributions that you reinvested to purchase more shares. You'll still owe tax on any capital gains distributions or dividends that you reinvest, but because they'll be counted toward your basis, you won't be taxed again when you sell the shares.

So to calculate the cost basis of the shares you've sold, you'll need to know the dates of each share purchase or sale for the length of time you've been invested in the fund; the number of shares bought or sold each time; the price at which shares were bought or sold; the total dollar amount of each transaction; and any sales charges or redemption fees paid.

And now for the fun part: The IRS gives you a choice of four ways to figure out your cost basis. Each method -- first-in, first-out (FIFO), specific shares, average cost single category and average cost double category -- allows investors to manage the tax implications of each selling decision.

First-In, First-Out

The FIFO method is the most common way of computing cost basis -- largely because if you don't specify another method, the IRS will use this as the default.

This method has the added advantage of simplicity -- like the name implies, the calculation assumes that the first shares acquired (first-in) are the first sold (first-out).

If you've been in a fund for many years, this method can often result in large per-share gains, because the shares you bought oh-so-many years ago were likely purchased at a lower price than what the fund is trading at now. If you're selling shares in a fund you first bought into during the boom years, it could well be trading at a loss now.

If you're selling the bulk of your fund or if you haven't made that many transactions, this could be the simplest and effective method.

Specific Identification

The specific identification method enables you to choose exactly which shares you are selling. Clearly, this strategy gives investors more control over whether they'll generate a gain or a loss.

That control, though, comes for a price -- your time and patience. Unlike FIFO, you need to decide in advance of the sale if you want to use this method. Send your mutual fund company a written request indicating the number of shares to redeem, the date they were purchased and the purchase price -- all before you sell.

Average Cost, Single and Double Category

Investors who don't redeem shares all that often may find the average cost method the easiest. Simply elect to calculate the cost basis of your mutual fund shares using an average price. You'll have to state exactly what you're doing on your tax return; and once you've informed the IRS that you're using this method, you're stuck with it until you get IRS permission to revoke it.

The single category method averages all shares owned at the time of the sale; the double category method requires you to separate shares with a long-term holding period (those you've owned for more than a year) from those with a short-term holding period (one year or less).

Like the specific identification method, you should send a letter to the fund company identifying which shares you wish to sell. If you don't alert the fund company to the specifics ahead of the sale, you must first charge the shares sold against the long-term category, the remainder against shares that fall into the short-term category.

No method is necessarily better than any other. Each method could hold wildly different tax implications -- particularly if you've been invested in the fund for several years. The average cost method might result in a taxable gain, while using the specific identification method would help you isolate the same number of shares to sell, but turn that taxable gain into a capital loss.

You're not allowed to switch back and forth within a fund, though. You can calculate your cost basis differently in each of your funds, but once you've used a method for a fund, you need IRS permission to change it for that fund.

Most fund companies will calculate your overall basis in a fund for you, although most charge upwards of $75 for the service.

Fidelity Investments, though, rolled out a new program earlier this year. Fidelity has put its new record-keeping system on the Web, allowing its customers to sift through as many as 150 of their own purchases to see what they paid for each lot of mutual fund shares and, consequently, which would be the most advantageous to sell.

So far, Fidelity's system seems unique, although other big fund shops such as Vanguard are testing the idea of developing their own, similar system.

Until such a tool is available to all investors, though, those who want to make the most of their investing and tax decisions will just have to sit with stacks of statements and a calculator. And a whole lot of coffee.

If you liked this article you might like

Kerry's Take on Taxes

Kerry's Take on Taxes

Some Growth Funds That Take a Low-Tech Approach

Some Growth Funds That Take a Low-Tech Approach

Ask Bev: Looking at Wash Sales, Covered Calls

Ask Bev: Looking at Wash Sales, Covered Calls

Putnam Plans Fund-Fee Cuts

Putnam Plans Fund-Fee Cuts

Bush Avoids Most Budget Issues in State of the Union Address

Bush Avoids Most Budget Issues in State of the Union Address