Calculating and adjusting cost basis accurately is a daunting task, but there is a (paid) online tool, NetBasis, which will automatically calculate and adjust your cost basis. It is used by brokerage firms and Fortune 500 companies and is available to the public. Go to netbasis.com.
All you need are the purchase and sale dates and shares of the stock or mutual fund and the system has the rest of the information, such as corporate actions (splits, spin-offs, etc), pricing, and dividends and it also will apply the appropriate IRS rules for inherited and gifted shares. The regulation also gives investors the option to choose calculation methods. Not only does NetBasis automatically calculate the method you choose, it will also give the results for all options and allow you to choose the best result.
NetBasis also provides you with detailed supporting documentation which shows all of the calculations and the adjustments in chronological order.
NetBasis has data going back as far as 1925, so it will accurately calculate cost basis for your old American Telegraph and Telephone shares. NetBasis also handles complex investment scenarios such as wash sales, short sales, return of capital, etc.
Moderator's note: Disclosure: The answerer's profile indicates they are affiliated with NetBasis.