Legendary investor Warren Buffett is doing something he’s always avoided — splitting shares of his beloved Berkshire Hathaway (Stock Quote: BRK.B). Each current share will be turned into 50.

It’s part of his purchase of Burlington Northern Santa Fe Corporation (Stock Quote: BNI) the railroad. The split will make it unnecessary for Burlington shareholders to receive partial Berkshire shares in the stock portion of the payment.

Splits of 50 for one are pretty rare, but many investors routinely experiences splits of two for one, three for two or some other combination. Splits don’t make shareholders any richer, since a typical two-for-one split would leave you with two $50 shares instead of one $100 share. Traditionally, companies split shares to keep prices low enough that investors can afford to buy in 100-share blocks.

But a split can leave you with a headache after you sell shares and must figure the tax implications of gains and losses. Along with reinvested dividends, splits can create a mess for the investor who hasn’t kept good records.

Berkshire Hathaway’s Class B shares are trading at about $3,380. If the split were to take place immediately, a new share would be worth about $68. Imagine you’d bought 10 Berkshire shares at the start of the decade, when they were trading for about $2,000. And suppose you sold them a few months from now for $70 each. How would you figure the tax on gains?

It’s not as tricky as it seems. Your “cost basis,” or the amount you paid, is $20,000. Forget that you’d received just 10 shares. Instead, pretend you’d bought 500, the number you’d have after the split. That makes your cost $40 per share. A share sold for $70 in a few months would have a long-term capital gain of $30. At the maximum long-term capital gains rate of 15%, the tax would be $4.50 per share.

Reinvested dividend payments can be harder to deal with, though the logic is about the same. Many stock and mutual fund investors have dividends automatically reinvested in more shares. Since you are taxed on dividends in the year you receive them, you don’t have to pay tax on that reinvested sum after you sell the shares.

Suppose you paid $2,000 for 10 shares of XYZ Corp, or $200 a share. Later, each share paid $20 in dividends, and you used that to buy two more shares at $100 each. Your cost basis is now $2,200 for 12 shares, or $183.33 per share.

You would use this cost basis if you were to sell all the shares. Or you could sell some or all of the initial 10 shares, using a cost of $200 each. Then you would use the $100 cost when you sold the final two shares.

In real life it can be much messier, with a block of shares amassed over the years at different prices, adjustments for one or more splits, and shares purchased at different prices with dividends. The key is to tally the total amount invested and divide by the number of shares you ultimately have to come up with a cost per share.

Of course, that takes good record keeping. Fortunately, most brokerages and mutual fund companies can tally cost basis for you, and probably include it in quarterly and annual statements. But it pays to keep records to double check, or to keep the record complete if you move your holdings from one financial services firm to another.

—For the best rates on loans, bank accounts and credit cards, enter your ZIP code at BankingMyWay.com.