However, you have other options for cost basis calculations, including a first in, first out calculation that allows you to use the shares of the first grouping you purchased as your basis. Sometimes, you can sell specific shares based on their individual cost basis, which your brokerage will provide for you.
Other events can change your cost basis, including stock splits, which will affect your average cost basis per share, reinvesting dividends, and inheritance. Also, remember to include the cost of your brokerage fees, since those can be counted toward your cost basis, too.