How to Calculate Stock Profit

By Inyoung Hwang · July 20, 2022 · 13 minute read

We’re here to help! First and foremost, SoFi Learn strives to be a beneficial resource to you as you navigate your financial journey. Read more We develop content that covers a variety of financial topics. Sometimes, that content may include information about products, features, or services that SoFi does not provide. We aim to break down complicated concepts, loop you in on the latest trends, and keep you up-to-date on the stuff you can use to help get your money right. Read less

How to Calculate Stock Profit

If you’re wondering how to calculate stock profit, it’s simple: Take the original price you paid for the stock and subtract it from the price at which you sold it. So if you paid $50 per share and the stock is now worth $55, your profit would be $5 per share.

If you bought 100 shares of the stock and realized a gain of $5 per share, that would be $500 in profit (not including any trading fees or commissions).

If the stock price has dropped since you bought it, you would subtract the current price from the original price, to arrive at the amount of your loss.

Understanding the implications of those gains (or losses) in terms of dollar amounts as well as percentages — and what to do next — is another matter. In most cases you’ll owe taxes on your gains, and/or you can use losses to offset gains. But when and how is where investors need to pay attention.

How Do You Calculate Stock Profit?

Given the history of the stock market, and the constant price fluctuations of almost every company, most investors should expect the price of the shares they buy to change over time. The question is: Is the change positive (a profit) or negative (a loss).

Realized Gains vs Unrealized Gains

Another question: Are those gains/losses realized or unrealized?

When a stock in your portfolio gains or loses value, but you hold onto it, that is considered an unrealized gain or loss. You wouldn’t pay additional trading fees and you wouldn’t (yet) face any tax implications because you haven’t actually sold the shares.

If you sell the shares, that’s when you realize (or take) the actual cash profit or loss in your account. At that point trading fees and taxes would likely come into play.

Formula to Calculate Percentage Gain or Loss of Stocks

Calculating stock profit can be done as a dollar amount or as a percentage change. The same is true of losses. While knowing the dollar amount that you’ve gained or lost is relevant for long-term planning and tax purposes, calculating the percentage change will help investors gauge whether one stock had good return when compared with another.

Percentage change = (Price sold – Purchase price) / (Purchase price) x 100

The important thing about this formula is to always have the purchase price in the denominator. That way the percentage change in the shares is always divided by what an investor paid for them.

Calculating Stock Profit Example

Here’s a hypothetical example using the formula above, but incorporating the number of shares an investor may hold. This will give the total dollar profit as well as the percentage move.

1.    Let’s say an investor owns 100 shares of Stock A, which they bought at $20 a share for a total of $2,000.

2.    The investor sells all of their shares when the stock is trading at $23, for $2,300.

3.    Ignoring any potential investment fees, commissions, or taxes in this hypothetical example, the investor would see a gain of $3 per share or $300 in profit.

4.    What’s the percentage gain? ($23 – $20) / $20 = 0.15 x 100 = 15 or a 15% gain.

Calculating Stock Loss Example

Now let’s look at an example where Stock A declines.

1.    Here, an investor owns 100 shares of Stock B, which they bought at $20.

2.    This time, the investor sells all 100 shares at $18.

3.    This means, the investor has to subtract $18 from $20 to get a $2 loss per share.

4.    What’s the percentage loss? ($20 – $18) / $20 = 0.10 x 100 = 10, or a 10% loss.

If you’re wondering how the returns you’re seeing compare with the average stock return, that number has historically hovered around 9%, when considering the market as a whole, over time.

And if you’re wondering about how to calculate stock profit when shorting stocks, that is a more complex strategy that requires careful understanding.

Calculating Percentage Change in Index Funds and Indices

As you may know, index funds are mutual funds that track a specific market index, which means they include the companies or securities in that index. An S&P 500 index fund mirrors the performance of the companies in the S&P 500 Index.

How to calculate the percentage change of your shares in an index fund? You can approach it the same way you would when you calculate profit or loss from a stock.

You can also calculate the difference between the percentage change of the index itself, between the date you purchased shares of the related index fund and sold them. Here’s an example, using the S&P 500 Index.

Let’s say the index was at 4,500 when you bought shares of a related index fund, and at 4,650 when you sold your shares. The same formula applies:

4,650 – 4,500 / 4,650 = 0.032 x 100 equals a 3.2% gain in the index, and therefore the gain in your share price would be similar. But because you cannot invest in an index, only in funds that track the index, it’s important to calculate index fund returns separately.

Importance of Calculating Stock Profit

Why is calculating stock profit (and loss) important? It’s an investing fundamental: You need to know what you’ve earned, i.e. what your gains and losses are, because your returns can impact:

•   Taxes owed

•   Your overall tax strategy (more on that below)

•   Your asset allocation

•   Your long-term financial picture

💡 Recommended: How to Buy Fractional Shares

Get up to $1,000 in stock when you fund a new Active Invest account.*

Access stock trading, options, auto investing, IRAs, and more. Get started in just a few minutes.

*Customer must fund their Active Invest account with at least $25 within 30 days of opening the account. Probability of customer receiving $1,000 is 0.028%. See full terms and conditions.

How Are You Taxed on Profit From a Stock?

You would start by subtracting the cost basis from the total proceeds to calculate what you’ve earned from a sale. If the proceeds are greater than the cost basis, you’ve made a profit, also known as a capital gain. At this point, the government will take a slice of the pie — you’ll owe taxes on any capital gains you make.

Capital gains tax rates are the rates at which you’re taxed on the profit from selling your stock (in addition to other investments you may hold such as bonds and real estate). You are only taxed on a stock when you sell and realize a gain, and then you are taxed on net gain, which is the difference between your gains and losses.

You can deduct capital losses from your gains every year. So if some stocks sell for a profit, while others sell for an equal loss, your net gain could be zero, and you’ll owe no taxes on these stocks.

Short-Term vs Long-Term Capital Gains Tax

There are two types of capital gains tax that might apply to you: short-term and long-term investment capital gains tax. If you sell a stock you’ve held for less than a year for a profit, you realize a short-term capital gain.

If you sell a stock you’ve held for more than a year and profit on the sale, you realize a long-term capital gain. Short-term capital gain tax rates can be significantly higher than long-term rates. These rates are pegged to your tax bracket, and they are taxed as regular income.

So, if your income lands you in the highest tax bracket, you will likely pay a short-term capital gains rate equal to the highest income tax rate — which is quite a bit higher than the highest long-term capital gains rate.

Long-term capital gains, on the other hand, are given preferential tax treatment. Depending on your income and your filing status, you could pay 0%, 15%, or a maximum of 20% on gains from investments you’ve held for more than a year.

Investors may choose to hold onto stocks for a year or more to take advantage of these preferential rates and avoid the higher taxes that may result from the buying and selling of stocks inside a year.

When Capital Gains Tax Doesn’t Apply

There are a few instances when you don’t have to pay capital gains tax on the profits you make from selling stock, namely inside of retirement accounts.

The government wants you to save for retirement, so they encourage people to set up certain tax-advantaged investment accounts, including 401(k)s and/or opening an individual retirement account.

You fund tax-deferred accounts such as 401(k)s and traditional IRAs with pre-tax dollars, which may help lower your taxable income in the year you make a contribution. You can then buy and sell stocks inside the accounts without incurring any capital gains tax.

These tax-deferred returns can give your savings an extra boost, potentially helping it grow faster than it would in a regular brokerage account. As tax-deferred returns are reinvested, investors are able to take greater advantage of the magic of compounding interest — the returns investors earn on their returns.

Tax-deferred accounts don’t allow you to escape taxes entirely, however, when you make qualified withdrawals after age 59 ½, you are taxed at your regular income tax rate. Roth accounts, such as Roth IRAs function slightly differently. You don’t escape taxes here either, since you fund these accounts with after-tax dollars.

Then you can also buy and sell stocks inside a Roth account where any gains grow tax free. Once again, you won’t owe capital gains on profit you make inside the account. And in the case of a Roth, when you make withdrawals at age 59 ½ you won’t owe any income tax either.

Understanding Capital Losses

Now, let’s take a closer look at capital losses. You may be wondering why it would ever make sense to take a capital loss. However, capital losses could be an important tool to help you manage your taxes, thanks to a strategy called tax-loss harvesting.

Capital losses can be used to offset gains from the sale of other stocks. Say you sold Stock A for a profit of $15 and Stock C from another company for a loss of $10. The resulting taxable amount is now $5, or $15 minus $10.

In some cases, total losses will be greater than total gains (i.e. a net capital loss). When this happens, you may be able to deduct excess capital losses against other income. If an investor has an overall net capital loss for the year, they can deduct up to $3,000 against other kinds of income — including ordinary and interest income.

The amount of losses you can deduct in a given year is limited to $3,000. However, additional losses can be rolled over and deducted on the following year’s taxes.

There are other limitations with claiming capital losses. The wash-sale rule, for example, prohibits claiming a full capital loss after selling securities at a loss and then buying “substantially identical” stocks within a 30-day period.

The rule essentially closes a loophole, preventing investors from selling a stock at a loss only to immediately buy the same security again, leaving their portfolio essentially unchanged while claiming a tax benefit.

Another way investors try to defer taxes is through automated tax-loss harvesting, or strategically taking some losses in order to offset taxable profits from another investment.

Other Income From Stocks

You may receive income from some stock holdings in the form of dividends, which are unrelated to the sale of the stock. A dividend is a distribution of a portion of a company’s profits to a certain class of its shareholders. Dividends may be issued in the form of cash or additional shares of stock.

While dividends represent profit from a stock, they are not capital gains and therefore fall into a different tax category. (Different types of investment income are taxed in different ways.) Dividends can be classified as either qualified or ordinary dividends, which are taxed at different rates. Ordinary dividends are taxed at regular income tax rates.

Qualified dividends that meet certain requirements are subject to the preferential capital gains tax rates. Taxpayers are responsible for identifying the type of dividends they receive and reporting that income on Form 1099-DIV.

Brokerage Fees or Commissions

Then there are brokerage account fees or commissions that you might have paid when you bought the stock. You may have already forgotten about these costs, but they do have an effect on your investment’s profitability and, depending on the amounts involved, these fees could make a profitable trade unprofitable.

Tally all the fees you paid and subtract that sum from your profit to find out what your net gain was. Note that your brokerage account may do these calculations for you, but you might want to know how to do them yourself to have a better understanding of how the process works.

Some brokerage firms offer zero commission trading, but they may be engaging in a practice called payment for order flow, where your orders are sent to third parties in order to be executed.

When to Consider Selling a Stock

There are a number of reasons investors may choose to sell their stocks, especially when they may earn a profit. First, they may need the money to meet a personal goal, like making a down payment on a home or buying a new car. Investors with retirement accounts may start to liquidate assets in their accounts once they retire and need to make withdrawals.

Investors may also choose to sell stocks that have appreciated considerably. Stocks that have made significant gains can shift the asset allocation inside an investor’s portfolio. The investor may want to sell stocks and buy other investments to rebalance the portfolio, bringing it back in line with their goals, risk tolerance, and time horizon.

This strategy may give investors the opportunity to sell high and buy low, using appreciated stock to buy new, potentially cheaper, investments. That said, investors might want to avoid trying to time the market, buying and selling based on an attempt to predict future price movements. It’s hard to know what the market or any given stock will do in the future.

Sometimes investors may decide that buying a certain stock was a mistake. It may not be the right match for their goals or risk tolerance, for example. In this case, they may decide to sell it, even if it means incurring a loss.

The Takeaway

Assuming a stock’s price is higher when you sell it versus when you bought it, learning how to calculate stock profit is pretty easy. You subtract the original purchase price from the price at which you sold it. (If the selling price is lower than the purchase price, of course, you’d see a loss.)

It’s important to calculate stock profits and losses because it can impact your taxes. If you realize a gain, you may owe capital gains tax; if you realize a loss, you may be able to use the loss to offset your gains. Of course, if you’re trading stocks within an IRA, Roth IRA, or 401(k), you avoid any tax consequences.

It’s fundamental tactics like these that can help give you confidence as an investor. When you open an Active Invest account with SoFi Invest, you can start trading stocks right away, as well as ETFs, fractional shares, IPO shares, and more.

Start your stock portfolio with SoFi today.


Why is it important to calculate stock profit?

Investing in stocks comes with a certain amount of risk. It may help you to know what your gains and losses are so that you can gauge the winners and losers in your portfolio. Calculating stock profit also helps with tax planning and portfolio rebalancing.

How can you calculate stock profit?

Calculating the dollar amount is relatively simple (you subtract the final selling price from the original purchase price, or vice versa). The formula for determining the percentage change is also straightforward:

(Price sold – Purchase price) / (Purchase price) x 100 = Percentage change

What is an example of calculating stock profit?

An investor owns 100 shares of Stock X, which they bought at $50 a share for a total of $5,000. The price rises to $55, a gain of $5, and the investor sells all their shares for a $500 profit ($5,500 total), excluding commissions, taxes, fees.

What’s the percentage gain? ($55 – $50) / $50 = 0.10 x 100 = 10 or a 10% gain.

SoFi Invest®
SoFi Invest encompasses two distinct companies, with various products and services offered to investors as described below: Individual customer accounts may be subject to the terms applicable to one or more of these platforms.
1) Automated Investing and advisory services are provided by SoFi Wealth LLC, an SEC-registered investment adviser (“SoFi Wealth“). Brokerage services are provided to SoFi Wealth LLC by SoFi Securities LLC.
2) Active Investing and brokerage services are provided by SoFi Securities LLC, Member FINRA ( Clearing and custody of all securities are provided by APEX Clearing Corporation.
For additional disclosures related to the SoFi Invest platforms described above please visit
Neither the Investment Advisor Representatives of SoFi Wealth, nor the Registered Representatives of SoFi Securities are compensated for the sale of any product or service sold through any SoFi Invest platform.

Tax Information: This article provides general background information only and is not intended to serve as legal or tax advice or as a substitute for legal counsel. You should consult your own attorney and/or tax advisor if you have a question requiring legal or tax advice.

Financial Tips & Strategies: The tips provided on this website are of a general nature and do not take into account your specific objectives, financial situation, and needs. You should always consider their appropriateness given your own circumstances.


TLS 1.2 Encrypted
Equal Housing Lender