If you are absolutely stumped and have no records showing what you paid for your stocks, our recommendation is you go a website such as bigcharts.marketwatch.com that has historical quotes of stock prices. If you remember the year you bought the stocks, you can view what the stock price was that year. We would recommend you be conservative and use the lowest price the stock was trading for that year and use that as your estimate for your cost basis.
For example, if you remember you bought 50 shares of XYZ corporation in 2004, then go to a website that provides historical stock prices and you find out that XYZ traded between $12 and $15 a share in 2004. We would recommend using the $12 per share price and multiplying that be 50 shares to come up with a cost basis of $600 for the sale of the 50 shares of stock.
You should also document how you came up with the cost basis estimate. Print the web page showing the historical stock data for the year you purchased the stock, then write down how you came up with your estimate of cost basis. Then keep that documentation with your other tax records for the year, so if you are audited a few years down the road, you can remember how you came up with the cost basis.