When you sell or exchange your mutual fund shares, or if they are redeemed (a redemption), you will generally have a taxable gain or a deductible loss.
Per IRS Instructions for Form 8949 Sales and Other Dispositions of Capital Assets, on page 6:
Average basis. You can use the average basis method to determine the basis of shares of stock if the shares are identical to each other, you acquired them at different prices and left them in an account with a custodian or agent, and either:
Shares are identical if they have the same CUSIP number, except that shares of stock in a DRP aren't identical to shares of stock that aren't in a DRP, even if they have the same CUSIP number. (CUSIP numbers are security identification numbers.)
If you are using the average basis method and received a Form 1099-B (or substitute statement) that shows an incorrect basis, enter “B” in column (f), enter the basis shown on Form 1099-B (or substitute statement) in column (e), and see How To Complete Form 8949, Columns (f) and (g), later. For details on making the election and figuring average basis, see section 1012, Pub. 550, and Regulations section 1.1012-1(e).
Per IRS Publication 550 Investment Income and Expenses (Including Capital Gains and Losses), on page 44:
Special Rules for Mutual Funds
To figure your gain or loss when you dispose of mutual fund shares, you need to determine which shares were sold and the basis of those shares. If your shares in a mutual fund were acquired all on the same day and for the same price, figuring their basis is not difficult. However, shares are generally acquired at various times, in various quantities, and at various prices. Therefore, figuring your basis can be more difficult. You can choose to use either a cost basis or an average basis to figure your gain or loss.
You can use the average basis method to determine the basis of shares of stock if the shares are identical to each other, you acquired them at different times and different prices and left them in an account with a custodian or agent, and either:
Average basis is determined by averaging the basis of all shares of identical stock in an account regardless of how long you have held the stock. However, shares of stock in a DRP are not identical to shares of stock with the same CUSIP number that are not in a DRP. The basis of each share of identical stock in the account is the aggregate basis of all shares of that stock in the account divided by the aggregate number of shares.
Transition rule from double-category method. You may no longer use the double-category method for figuring your average basis. If you were using the double-category method for stock you acquired before April 1, 2011, and you sell, exchange, or otherwise dispose of that stock on or after April 1, 2011, you must figure the average basis of this stock by averaging together all identical shares of stock in the account on April 1, 2011, regardless of the holding period.
Note that any link in the information above is updated each year automatically and will take you to the most recent version of the document at the time it is accessed.