How to calculate the rate of return on selling a stock?
You probably want the Internal Rate of Return (IRR), see http://en.wikipedia.org/wiki/Internal_rate_of_return which is the compound interest rate that would produce your return.
You can compute it in a spreadsheet with XIRR(), I made an example: https://spreadsheets.google.com/ccc?key=0AvuTW2HtDQfYdEsxVlM0RFdrRk1QS1hoNURxZkVFN3c&hl=en
You can also use a financial calculator, or there are probably lots of web-based calculators such as the ones people have mentioned.
Simple math. Take the sale proceeds (after trade expenses) and divide by cost. Subtract 1, and this is your return. For example, buy at 80, sell at 100, 100/80 = 1.25, your return is 25%.
To annualize this return, multiply by 365 over the days you were in that stock. If the above stock were held for 3 months, you would have an annualized return of 100%.
There's an alternative way to annualize, in the same example above take the days invested and dive into 365, here you get 4. I suggested that 25% x 4 = 100%. Others will ask why I don't say 1.25^4 = 2.44 so the return is 144%/yr. (in other words, compound the return, 1.25x1.25x...) A single day trade, noon to noon the next day returning just 1%, would multiply to 365% over a year, ignoring the fact there are about 250 trading days. But 1.01^365 is 37.78 or a 3678% return. For long periods, the compounding makes sense of course, the 8%/yr I hope to see should double my money in 9 years, not 12, but taking the short term trades and compounding creates odd results of little value.
If annualized rate of return is what you are looking for, using a tool would make it a lot easier.
In the post I've also explained how to use the spreadsheet.
Hope this helps.