Stock profit = (Sell Price - Buy Price) × Shares - Fees. That is the whole formula. This guide walks through it with real numbers, covers edge cases, and gives you a free calculator to skip the math.
Three numbers you need:
You bought 75 shares of XYZ at $42.00. You sold at $56.50. Your broker charged $4.95 per trade.
For ROI:
Skip the math: Stock Profit Calculator does this instantly.
Enter your numbers, get profit + ROI instantly.
Calculate Stock Profit →| Scenario | Buy | Sell | Shares | Fees | Net Profit | ROI |
|---|---|---|---|---|---|---|
| Quick flip | $18.00 | $21.50 | 200 | $0 | $700.00 | 19.4% |
| Long hold | $35.00 | $89.00 | 100 | $0 | $5,400.00 | 154.3% |
| Small loss | $120.00 | $115.00 | 30 | $0 | -$150.00 | -4.2% |
| With commission | $55.00 | $68.00 | 150 | $9.95 each | $1,930.10 | 23.4% |
| Dollar cost avg | $47.50 avg | $62.00 | 300 | $0 | $4,350.00 | 30.5% |
Cost basis is your total investment in a position. It matters for taxes.
Your broker tracks cost basis for you, but knowing how it works helps you make better sell decisions.
Stock losses are not just bad news. In the US, you can use capital losses to offset capital gains, reducing your tax bill. If losses exceed gains, you can deduct up to $3,000 per year from ordinary income and carry forward the rest.
The calculator shows losses clearly in red. If you are considering selling a losing position for tax-loss harvesting, run the numbers first to see the exact loss amount.
Related: Percentage Calculator for quick math, Compound Interest Calculator for long-term growth.