Reinvestment of dividends works just like a new purchase of stock shares. The only real difference is the purchase happens automatically. By referencing the amount of dividends invested and the total number of shares purchased, you can calculate the cost basis of the stocks purchased through the reinvestment plan. Calculating this figure for each purchase is best, but if you only need the average cost basis, you can perform the same calculation on the total investment and shares purchased. You might opt to use the second, simpler method when selling your entire portfolio.
Reference your investment statements or contact your investment broker to look up the amount of each dividend reinvestment and the number of shares you acquired.
Total each of these figures if you only wish to calculate the average cost basis. As an example, if you reinvested $500 in dividends three times to acquire 25, 20 and 35 shares respectively, your total investment was $1,500 for 80 shares.
Divide the dividends reinvested by the number of shares acquired to calculate the cost basis per share. In the example, your cost basis would be $20, $25 and $14.29 per share for each respective reinvestment. If you were calculating the average cost basis, the result is $18.75.