Stocks are volatile little beasties – just look at 2020’s S&P 500 price chart to see how true that is. And if you’ve invested in the stock market at any point, chances are, you’ve seen your share of gains and losses. Knowing just how much you’ve gained or lost is a crucial component of being a savvy, informed investor. That’s why you need to know how to calculate your percentage gain or loss.

Calculating the percentage gain or loss on your investments tells you how profitable, comparatively, a particular position has been in your portfolio. This provides a way for you to compare the assets you hold – or could have held – against each other and your broader portfolio. (And if you’re the competitive type, you can calculate your percentage gain or loss against your friends to determine who bought in at the right time.)

The math in these equations is relatively simple and straightforward once you know how to use them. As with many things in investing, education and practice are the keys to success.

So, how do you calculate the percentage gain or loss on your investments?

## Calculating the Yield (or Lack Thereof) on Your Investments

To get started, you’ll need to gather the original purchase price (if you don’t have it on hand, you can get it from your broker) and your selling price. Once you have those, the math is simple – just use this formula:

**Gain or loss = ((Sale price – Purchase price) / Purchase price) x 100%**

If your final number is positive, that indicates a gain on your investment. But if your percentage is negative, you’ve taken a total loss.

Keep in mind that you can calculate your gain or loss at any time, whether or not you’ve sold your investment. Simply substitute in the current market price for the selling price to get the same result. And if you want to see how your investment has performed over the course of a particular year or quarter, pick the market price on a day of your choice to substitute in for the purchase price.

Let’s give an example of these calculations in action.

Say that you bought one share of iStock Corp for $200 and sold it for $300. Your formula would look like this:

**(($300 sale price – $200 purchase price) / $200 purchase price) x 100%**

**($100 / $200) x 100%**

**0.5 x 100% = 50%**

All told, you would see a 50% gain in your investment of iStock Corp. But what does it look like to incur a loss?

Let’s also say that you bought one share of EvilComputer, Inc. for $300, and later sold out for $200. You would calculate your percentage loss thusly:

**(($200 sale price – $300 purchase price) / $300 purchase price) x 100%**

**(-$100 / $300) x 100%**

**-0.3333 x 100% = -33.33%**

In this case, the negative in front of your percentage change indicates a total loss of 33.33% of your investment.

## Considering Fees and Dividends

However, it’s rare that you simply buy and sell a stock, full-stop. You’re likely to also encounter brokerage fees, commissions, or dividends that alter your final earnings.

Fortunately, you can calculate these into your equation, too. Once again, the math is simple: just reduce or increase your final gains by the costs (or yields) of investing.

### Accounting for Fees

Let’s go back to our example of iStock Corp, where you purchased one share for $200 and sold it for $300. In our original example, your final gain was 50%.

But let’s also consider that you incurred $50 in transaction fees from the broker ($25 when you bought the investment, and another $25 when you sold).

Your formula would look like this:

**(($300 sale price – $200 purchase price – $50 fees) / $200) x 100%**

**(($100 – $50) / $200) x 100%**

**$50 / $200 = 0.25**

**0.25 x 100% = 25%**

As you can see, adding additional brokerage fees reduced total returns by half.

### Accounting for Dividends

Dividends are a company’s way of saying “thank you for investing in us.” And depending on the amount, they can provide a cushy little bonus to investing in a particular company. So, when you calculate how much your investments have gained, you’ll also want to consider dividends and special payouts in your equation.

This time let’s assume that there are no brokerage fees on your investment. Instead, you earned a total dividend of $50 on your share for the year.

To calculate this, you would add the dividend payment into your equation as such:

**($300 sale price – $200 purchase price + 50 dividend) / $200 purchase price**

**($150 / $200) x 100%**

**0.75 x 100% = 75% gain**

In this instance, you earn a total 75% gain on your investment, assuming that there are no fees to consider. (And if you wanted to consider any applicable fees, you would simply subtract them on the left-hand side of the equation.)

By using these (slightly) more complex versions of the basic equation, you can get a more accurate picture of your total gains and losses on a particular investment.

## When to Use These Calculations

Note that you can use these calculations on any number of shares, not just one at a time.

For instance, if you buy 100 shares of a company but only sell 50 shares, you can calculate how much those 50 shares cost (purchase price of one share x 50 shares). Then, you commence with the calculation to see how much you gained or lost on the portion of investment you sold.

In the reverse, you can also calculate your per-share cost based on the original purchase price of your total investment. So, if you know that buying 50 shares cost you $500, you’d divide your total price by the number of shares ($500 purchase price / 50 shares) to get a per-share price of $10.

Moreover, you can use these calculations to determine the percentage gain or loss on your entire portfolio – not just individual investments. Simply use a starting price of your choice – for instance, the first day of the most recent year or quarter – and an end date of your choice, such as the last day of the year or quarter. Substitute those in for your sale and purchase prices, respectively, and voila!

And if you want to take it one step further, you can use these equations to see how well various indices, such as the S&P 500 or Dow Jones Industrial Average, performed in the same period. Then, you can compare the result against your stock or portfolio to see how you’ve fared compared to the broader market.

## When to Consider Selling a Stock

Now that you know how to calculate the percentage gain or loss on your investments, you might want to know when to consider realizing your profit. But keep in mind that the “right” reason or time to sell may differ for every investor.

For instance, some investors use the stock market as a form of high-interest piggy bank to save for long-term personal goals. When the time is right, or the market is riding a current high, they cash out to pay their down payment, invest in a new car, or pay for that brand-new tv.

Similarly, investors who use hold invested retirement accounts often start to sell positions or make withdrawals when it comes time to kick back and relax.

Many investors also sell off assets that have appreciated considerably to rebalance their portfolio. Getting rid of high-priced assets not only reduces overextended positions but provides some liquidity to reinvest in lower-cost securities with room yet to grow.

Or an investor might decide that a particular investment was a mistake. Whether you take pennies in gains or hundreds of dollars in losses, sometimes, it’s just time to get out and move on.

**Download Q.ai Invest and let AI manage your money with institutional-grade, AI-powered investment strategies – totally commission-free.**