Question: how to calculate total cost basis?
Answer: Use the information you have about the purchase price of the stock, dividend payments and brokerage commissions to calculate the total cost basis, then subtract that amount from the gross proceeds to get the amount of your capital gain. The gain is what you must report to the IRS, and pay taxes on.