The current wave of M&A mania is putting money into the pockets of investors as the acquiring companies pay a pretty premium for their targets.

But while you're happily counting your profits, you may want to run a different set of numbers.

Mergers, spinoffs and stock-splits wreak havoc on your shares' cost basis, a.k.a. originalcost. If you hold shares in a company that merged with another, your initial investment now has to bedivided between the old company and the new one.

Bring on the confusion.

Now, while


(T) - Get Report

seems to be themaster of basis confusion, it's certainly not the only culprit. If you're a longtime holder of

J.P. Morgan Chase

(JPM) - Get Report

you're in the same boat. Same goes for the

Bank of America

(BAC) - Get Report


And it's not just your longtime holdings that have basis bafflement. Last year was a busy one for M&A,especially in tech.


(CIEN) - Get Report

acquired Catena,



boughtTelica and



scooped upSpatial Wireless. In addition,


(VIA) - Get Report

spun off


(BBI) - Get Report

. Any ideawhat your basis in those shares is now?

Unfortunately, if you sold any shares that were part of a merger, spinoff or stock split in2004, you need to know your original basis as you prepare your tax return now. That's because theonly way to figure out your gain on the sale is to know what you originally paid for the shares.So if you initially invested $1,000, even though your company's stock split and was merged or absorbed into another, your investment isstill only $1,000. That money now has to be allocated among all those new pieces.

In the case of the upcoming AT&T merger with



, or any other proposed deal, you may want to sell your shares beforethe merger even takes place. Especially since the current stock value takes into account the futuretransaction. But if you're one of the fortunate AT&T shareholders whose investment has appreciated, you should know what your tax gain would be if you decided to sell, says StevieD. Conlon, senior tax analyst for CCH Capital Changes, a company that provides coverage ofcorporate actions affecting publicly traded companies. That could be a big factor in your finalanalysis.

Fortunately, since AT&T is the poster child for merged/spun-off/split stocks, the investorrelations section of the site is very helpful. Plop your numbers in their

tax basis worksheets and instantly calculate your basis.

But if a company's Web site doesn't have all the information you need, you'll have to put on yourdetective gear and start digging.

So How Do You Unbury Your Basis?

Here are some options.

Go on the Web and gather information about your company's mergers, spinoffs and stocksplits using a stock source like Yahoo! Finance and create a spreadsheet that tracks the basisin each of your shares, suggests Bill Fleming, director of personal financial services atPricewaterhouseCoopers in Hartford, Conn. You'll need to do a ton of math, but this is the informationyour tax preparer's going to need anyway. So it might make sense to sit down and get it done.

If the thought of number crunching makes you ill and you sold shares with an unknown basis,you could just throw in the towel and pay tax on the whole gain, says Fleming. Let's sayGreat-Aunt Betty gave you shares that are currently trading at $20, a.k.a. the fair market value.You have no idea what the basis is so you decide to be conservative and just assume it's zero.You'll owe tax on the difference between your basis, zero and $20. You'll never have to worryabout Uncle Sam knocking on your door because you probably overpaid him. But at least you didn'thave to do the research or pull out the calculator.

Here's a tip going forward, though. If someone gives you some stock, first say "thank you" andthen ask how much they paid for those shares so you can update your records.

Consider dying with the shares. Then your heirs will get the step-up in basis to fairmarket value at your death and no one will care what you originally paid for them.

Or give them to charity. You'll get a charitable deduction for the fair market value of theshares and, again, no reason to know your original cost.

Here's a better solution. Consider using, a tax lot accounting program thatwill do all your basis work for you. For a mere $49 a year, it will keep track of all thecorporate actions that complicate the stocks in the average investor's portfolio.The corporate action database only goes back to Jan. 1, 1999, says Cameron Routh, vice president ofpartner relations at GainsKeeper. So if you bought your AT&T shares before that, you're on yourown. But for your more recent purchases, just plug in your original transaction and it will takeinto account everything that has happened and recalculate your basis.Let's assume you bought 100 shares of EMC on Feb. 25, 1999, at $105 per share, a $10,500 investment. With a spinoff, afew stock splits and three mergers since then, your basis is now a big enigma. Compute that initialinvestment in GainsKeeper and you'll find that you now have 400 shares of EMC with a cost basis of$25.67 per share and 14.7 shares of McDATA at $15.62 per share. Total investment is still $10,500. Pretty cool, huh?It'll do the same for your AT&T shares, albeit from Jan. 1, 1999, on. So if you bought 100 AT&T shares for $85 back on Feb. 25, 1999, you now have 30 shares of AT&T and 48.5 shares of Comcast after10 different corporate actions, including mergers, stock splits and spinoffs. You can import your portfolio directly from your broker's site in most instances. GainsKeepersupports about 50 different brokers, including Ameritrade , E*Trade Charles Schwab andFidelity, says Routh. So import your portfolio and let the site keep track of your cost basis.

Otherwise get out the calculator. You're going to need this information at some point, whether it'sfor this year's tax return or later on when you sell your shares to fund your kid's college education.

So start getting basis-happy now.

Tracy Byrnes is an award-winning writer specializing in tax and accounting issues. As a freelancer, she has written columns for and the New York Post and her work has appeared in SmartMoney and on CBS MarketWatch. Prior to freelancing, she spent four years as a senior writer for Before that, she was an accountant with Ernst & Young. She has a B.A. in English and economics from Lehigh University and an M.B.A. in accounting from Rutgers University.