Stock Calculator
Calculate the profit or loss from a stock trade. Enter your buy price, sell price, number of shares, and any commissions to see your total and percentage return.
Understanding Stock Returns
When you buy a stock and later sell it for a higher price, the difference is your capital gain. When the selling price is lower than what you paid, you've realized a capital loss. It sounds simple, and the basic math is simple, but there are details that many investors overlook when calculating their actual returns.
The per-share gain or loss is just the starting point. Multiply it by your share count to get the gross dollar return, then subtract any commissions, fees, or taxes to see what actually ended up in your pocket. An investor who bought 200 shares at $30 and sold at $35 sees a gross profit of $1,000. But if they paid $10 in commissions each way, the net drops to $980. With older commission structures that used to run $20 to $50 per trade, the impact was much larger on smaller positions.
Percentage return matters more than dollar return for comparing investments. A $500 profit on a $5,000 investment is a 10% return. That same $500 on a $50,000 investment is only 1%. The percentage tells you how hard your money actually worked. Always calculate returns as a percentage of your total cost basis, the full amount you spent including commissions, to get an honest assessment of performance.
Capital Gains and Tax Implications
Selling a stock at a profit triggers a capital gains tax event. How much you owe depends on how long you held the position. If you owned the shares for more than one year before selling, the gain qualifies as long-term and is taxed at preferential rates: 0%, 15%, or 20% depending on your income level. Most investors fall into the 15% bracket.
Short-term capital gains apply to stocks held for one year or less. These are taxed at your ordinary income tax rate, which could be anywhere from 10% to 37%. The difference is significant. On a $10,000 gain, you might owe $1,500 at the long-term rate versus $2,400 or more at the short-term rate. That's a strong incentive to hold positions for at least a year and a day before selling.
Capital losses have a silver lining. You can use them to offset capital gains dollar for dollar. If you had $8,000 in gains from one trade and $3,000 in losses from another, you're only taxed on the net $5,000. If your losses exceed your gains, you can deduct up to $3,000 per year against ordinary income and carry any remaining losses forward to future years. This is called tax-loss harvesting, and savvy investors use it deliberately to manage their annual tax bills.
Keep in mind that wash sale rules prevent you from selling a stock at a loss and buying it back within 30 days to claim the deduction. The IRS disallows the loss in that scenario, adding it to the cost basis of the repurchased shares instead.
Dollar Cost Averaging and Position Building
Very few investors buy all their shares at a single price. Most build positions over time, buying shares on multiple occasions at different prices. This approach, called dollar cost averaging, means your actual cost basis is the weighted average of all your purchase prices.
Here's a practical example. Say you buy 50 shares of a stock at $40, then another 50 shares at $36 after a dip, and a final 50 shares at $44 when it recovers. Your total investment is $6,000 for 150 shares, giving you an average cost of $40 per share. If the stock eventually trades at $50, your gain per share is $10, not the $6 difference between your last purchase and the current price.
Dollar cost averaging works well in volatile markets because it prevents you from putting all your money in at a peak. By spreading purchases across time, you naturally buy more shares when prices are low and fewer when prices are high. Over years of regular investing, this tends to reduce the average cost below the simple average of the stock's price during that period.
The main drawback is that in a consistently rising market, dollar cost averaging produces lower returns than investing a lump sum immediately. Studies have shown that lump sum investing beats dollar cost averaging about two-thirds of the time when looking at historical data. But the psychological benefit of gradual entry shouldn't be underestimated. Many investors who try to deploy a large sum all at once end up paralyzed by the fear of buying at the wrong time, and cash sitting on the sidelines earns very little.
Common Investing Mistakes to Avoid
Even experienced investors fall into patterns that hurt their returns. The most destructive is emotional trading, selling in a panic during market drops and buying enthusiastically at market highs. This buy-high-sell-low cycle is the exact opposite of what makes money. Studies consistently show that the average investor underperforms the market by 3% to 4% per year, primarily because of poorly timed trades driven by fear and greed.
Another common mistake is ignoring fees and commissions when they exist. While many major brokers now offer commission-free stock trading, other costs still apply. Mutual fund expense ratios, options contract fees, margin interest, and currency conversion charges can all nibble away at returns. An expense ratio of 1% versus 0.1% on a $100,000 portfolio costs you $900 per year, which compounds into tens of thousands over a lifetime of investing.
Overconcentration is risky no matter how confident you are. Putting 50% or more of your portfolio in a single stock means a company-specific disaster, a scandal, a product failure, a regulatory crackdown, can wipe out a huge chunk of your wealth. Diversification across 15 to 30 stocks, or simply using a broad index fund, provides protection against any single company's misfortune.
Finally, many investors neglect to track their actual performance. They remember the winners vividly and quietly forget the losers, creating a distorted mental picture of how well they're doing. Keep a simple spreadsheet or use your broker's reporting tools to track every trade. Knowing your real numbers, including the losses, is the only way to improve over time.
Formula
Net Return = (Sell Price − Buy Price) × Shares − Buy Commission − Sell Commission
The stock return formula calculates the gross gain or loss by multiplying the per-share price difference by the number of shares, then subtracts any commissions to arrive at the net result. The percentage return divides this net profit or loss by the total cost basis, which includes both the share purchase cost and the buy commission. This gives you a clear picture of the actual return on every dollar you invested in the trade.
Where:
- Buy Price = The cost per share at the time of purchase.
- Sell Price = The price per share at the time of sale.
- Shares = The quantity of shares bought and sold.
- Commissions = Fees charged by the broker for executing the buy and sell trades.
Example Calculations
Profitable Stock Trade
An investor buys 100 shares at $50 and sells at $75 with no commissions.
- Calculate total cost: 100 × $50 = $5,000
- Calculate total revenue: 100 × $75 = $7,500
- Calculate gross profit: $7,500 − $5,000 = $2,500
- Subtract commissions: $2,500 − $0 − $0 = $2,500
- Calculate percentage return: ($2,500 / $5,000) × 100 = 50%
A 50% return is excellent for any single trade. If held for more than a year, the $2,500 gain would be taxed at long-term capital gains rates, typically 15%, resulting in $375 in tax and a net after-tax profit of $2,125.
Trade with Commissions
An investor buys 500 shares at $22.50 and sells at $28.75, paying $9.99 commission each way.
- Calculate total cost: (500 × $22.50) + $9.99 = $11,259.99
- Calculate total revenue: 500 × $28.75 = $14,375
- Calculate gross profit: $14,375 − $11,250 = $3,125
- Subtract commissions: $3,125 − $9.99 − $9.99 = $3,105.02
- Calculate percentage return: ($3,105.02 / $11,259.99) × 100 = 27.58%
The $19.98 in total commissions reduces the return only slightly on this larger trade. However, on a small trade of 10 shares, the same commissions would eat up $19.98 of a $62.50 gross gain, reducing the net return by nearly a third. Commissions matter most on smaller positions.
Frequently Asked Questions
Your cost basis is the total amount you spent on all share purchases divided by the total number of shares. If you bought 50 shares at $30 and 50 shares at $40, your total cost is $3,500 for 100 shares, giving an average cost basis of $35 per share. Most brokerages track this automatically, but it's worth verifying if you've transferred shares between accounts or received shares through corporate actions like stock splits or spin-offs.
An unrealized gain or loss exists on paper while you still hold the stock. It becomes realized when you sell. Only realized gains are taxable. This means you can hold a stock that's doubled in value for decades without owing any tax, as long as you don't sell. This is sometimes called the buy-and-hold advantage. Unrealized losses can't be used to offset gains on your tax return either. You must actually sell the position to harvest the tax benefit.
Absolutely. Total return includes both capital appreciation and dividends received. If you bought a stock for $50, received $5 in total dividends, and sold for $60, your total return is $15 per share, not just $10. Excluding dividends significantly understates returns, especially for income-oriented stocks. Over the past century, dividends have accounted for roughly 40% of the total return of the S&P 500.
A stock split changes the number of shares you own and the price per share, but not your total investment value. In a 2-for-1 split, your 100 shares at $80 become 200 shares at $40. Your cost basis per share drops to half of the original, but your total cost basis remains the same. When calculating returns, make sure you use the split-adjusted buy price. Your brokerage should handle this automatically in their reporting.
The US stock market has delivered average annual returns of roughly 10% before inflation over the past century. After adjusting for inflation, that drops to about 7%. Any individual stock or portfolio that consistently beats the market average is performing exceptionally well. Keep in mind that average returns are lumpy: the market might gain 25% one year and drop 15% the next. Very few years deliver exactly the average. Expecting steady 10% returns each year will lead to disappointment. Focus on long-term averages over 10 to 20 year horizons.