How to Calculate Basis Shares Purchased From Payroll Deduction Throughout the Year

When you use part of your paycheck to invest in stocks throughout the year, your tax basis in the shares is equal to the total of all payroll deductions. Your tax basis will include the market price at which you purchase each share of stock, plus the commissions your broker charges to execute the trades. However, unless you sell all of the stocks at the same time, the IRS requires you to calculate the tax basis for each specific share.

Calculate total shares you purchase through payroll deductions. If you purchase the shares of stock at the same price during the year, assess the number of shares you purchase during the year and the total price you pay for them through payroll deductions. Divide the total number of shares by the total payroll deductions to establish the tax basis for each share.

Identify the tax basis for each separate stock purchase. In the event you purchase stock at various market prices during the year, it’s important that you allocate the appropriate tax basis to each separate stock purchase. Divide the amount of each payroll deduction by the number of shares you obtain for that period to arrive at the tax basis per share.

Use a first-in-first-out approach when calculating the tax basis of shares you sell. When you purchase the same stock at various times throughout the year, the IRS requires you to sell the shares in the same order you purchase them. For example, suppose you purchase 10 shares of stock at $10 per share on January 1, an additional 10 shares at $12 per share on March 1 and another lot of 10 on April 1 at $14 per share. If you sell 15 shares on June 1, you must calculate your gain or loss using the tax basis of all shares you purchase on January 1 and five of the shares you purchase on March 1.

Increase your tax basis for brokerage commissions. Although your tax basis for each share will include the commission charges for executing your buy trades, the IRS allows you to increase your tax basis for the same commission your broker charges when executing a sell trade. Therefore, when you sell some of your shares, always increase your tax basis for the expenses you incur to sell the stocks when calculating your gain or loss.


  • If you purchase stock in the same company at various times and prices throughout the year, the IRS never allows you to use the average purchase price for your tax basis when selling only part of your stock portfolio.