How Do I Calculate My Gains and Losses When I Sell a Stock?

To calculate the gains or losses on a stock investment, one must first know the cost basis, which is the purchase price initially paid for the stock. Investors who neglected to record this information may find it on the order execution confirmation form or the brokerage account statement from the date of the purchase.

Once investors learn the purchase price, they must next consider the stock's selling price, which may likewise be sourced from the same documents.

Key Takeaways

  • Calculating the gains or losses on a stock investment involves a straightforward process.
  • The process involves determining the cost basis, which is the purchase price initially paid for the stock, and recognizing the selling price. 
  • Investors then calculate the difference between the purchase price and the sale price to determine the gains or losses per share. 
  • Finally, investors multiply gains or losses per share by the number of shares.

Purchase vs. Sale Price

The difference between the purchase price and the sale price represents the gain or loss per share. Multiplying this value by the number of shares yields the total dollar amount of the transaction. Investors who wish to determine a more accurate number may also factor in any brokerage commission fees related to the purchase or sale of the stock.

Investors must then consider the tax consequences of the investment, which kicks in if the stock was housed in a non-retirement account. Under the current U.S. tax code, if investors hold the stock for less than one year, the capital gain/loss will be deemed short term and will consequently be calculated as ordinary income for tax purposes. But if a profitable stock is held for more than one year, it will be subject to a standard capital gains tax of 15%.

If a stock splits, investors must adjust their cost price accordingly. For example, if the stock purchase price was $25, and it splits 2 for 1, the cost basis would be adjusted to $12.50 per share.

Consider the following scenario. Suppose you buy 100 shares of XYZ stock on Aug. 1, 2021, for $20 a share. Let's further assume you sell 50 shares of this stock on Sept. 1, 2022, for $25 a share. On a per-share basis, the long-term gain would be $5 per share. Multiplying this value by 50 shares yields $250. Then, if you multiply that number by the 15% capital gains, it yields $37.50, which would be the tax consequences for this transaction.

Tom Cymer, CFP®, CRPC®, CFA
Opulen Financial Group, LLC, Arlington, Va.

The first step in calculating gains or losses is to determine the cost basis of the stock, which is the price paid, plus any associated commissions or fees.

For example, assume you bought 10 shares of XYZ stock at $100 a share, for $1,000, and paid a $50 commission to your broker. In this case, the total cost basis is $1,050. Dividing $1,050 by 10 (the number of shares owned) equals the cost basis per share.

Next, you must adjust your basis for any stock dividends that were reinvested. Let's assume your stock paid $100 in dividends, which you then paid tax on via Form 1099-DIV. You can now adjust your basis upwards: $1,050 + $100 = new basis of $1,150. The difference in proceeds from the sale will be your gain or loss.

Article Sources
Investopedia requires writers to use primary sources to support their work. These include white papers, government data, original reporting, and interviews with industry experts. We also reference original research from other reputable publishers where appropriate. You can learn more about the standards we follow in producing accurate, unbiased content in our editorial policy.
  1. Internal Revenue Service. "Topic No. 409 Capital Gains and Losses."

Take the Next Step to Invest
The offers that appear in this table are from partnerships from which Investopedia receives compensation. This compensation may impact how and where listings appear. Investopedia does not include all offers available in the marketplace.