Stock Profit & Capital Gains Calculator

Compute net profit, return on investment (ROI), trading commissions, and estimated capital gains taxes on equities and ETF trades.

4.9 / 5· 148 verified ratings
•
100% Client-Side Privacy
•
Verified 2026 Engine
Instant Calculation • 100% Client-Side Privacy • Multi-Currency ($ / ₹ / £ / €)
Loading tool engine...
Frequently Used With:Tip & Bill Split Calculator →Salary to Hourly Wage Calculator →Credit Card Payoff & Interest Calculator →SIP & Recurring Investment Calculator →
Institutional-Grade Accuracy & Client-Side Privacy Guarantee

Unlike conventional calculator sites that send your financial numbers, payload data, or code snippets across remote web servers, Affi-Chain processes all mathematical derivations, algorithms, and data parsing 100% locally within your browser sandbox. No tracking cookies, no server-side retention, and zero transmission lag.

What is Stock Trading Profit, ROI & Capital Gains?

The Stock Profit Calculator is an investment finance and equity trading tool that computes net monetary profit, Return on Investment (ROI percentage), total cost basis, brokerage commission fees, and capital gains tax liabilities for public equity transactions. In stock market trading, exchange-traded fund (ETF) investing, and portfolio management, evaluating trading performance requires looking beyond simple share price appreciation.

A retail investor who buys a stock at $100 and sells at $110 did not necessarily realize a net 10% gain. In real-world brokerage accounts (Charles Schwab, Fidelity, Interactive Brokers, Robinhood), net profitability is impacted by:

  • Brokerage Commissions & Platform Fees: Fixed or per-share transaction charges on both entry and exit.
  • Regulatory Fees: SEC Section 31 transaction fees and FINRA Trading Activity Fees (TAF) on sales.
  • Capital Gains Taxation: The dramatic tax rate disparity between short-term capital gains (taxed at ordinary income rates up to $37%$) and long-term capital gains ($0%$, $15%$, or $20%$).

The Affi-Chain Stock Profit & ROI Calculator calculates exact net returns, breakeven share prices, and after-tax proceeds directly in your browser with complete confidentiality.


The Core Financial Equations & Mathematical Formulations

Accurately modeling trading performance requires calculating cost basis, net proceeds, and tax obligations sequentially:

1. Total Cost Basis Formula

The cost basis represents the total out-of-pocket capital required to initiate the position:

$$\text{Cost Basis} = (\text{Quantity } Q \times \text{Buy Price } P_{\text{buy}}) + \text{Buy Commission } C_{\text{buy}}$$

2. Net Exit Proceeds Formula

The gross capital received upon liquidating the position, minus exit transaction fees:

$$\text{Net Proceeds} = (\text{Quantity } Q \times \text{Sell Price } P_{\text{sell}}) - \text{Sell Commission } C_{\text{sell}} - \text{Regulatory Fees}$$

3. Net Pre-Tax Profit & ROI Formulation

$$\text{Net Profit ($)} = \text{Net Proceeds} - \text{Cost Basis}$$ $$\text{Return on Investment (ROI %)} = \left( \frac{\text{Net Profit}}{\text{Cost Basis}} \right) \times 100$$

4. Mathematical Break-Even Share Price

To determine the exact exit price required to cover all purchase costs and commissions without incurring a loss:

$$P_{\text{breakeven}} = \frac{(\text{Quantity } Q \times P_{\text{buy}}) + C_{\text{buy}} + C_{\text{sell}}}{Q}$$


Short-Term vs Long-Term Capital Gains Taxation Matrix

In the United States and most international tax jurisdictions, holding duration dictates tax liability:

Holding DurationTax ClassificationApplicable Tax RateImpact on $10,000 ProfitNet Kept by Investor
Held $\le 365$ DaysShort-Term Capital GainOrdinary Income Bracket ($10% - 37%$)$3,200 (at 32% bracket)$6,800
Held $> 365$ DaysLong-Term Capital GainPreferential Rates ($0%$, $15%$, or $20%$)$1,500 (at 15% rate)$8,500

Takeaway: Holding an equity position for 366 days instead of 364 days can save an investor thousands of dollars in statutory tax obligations on the exact same gross profit!


Step-by-Step Practical Calculation Example

Consider an investor purchasing 200 shares of a technology company at $120.00 per share, paying a $5.00 buy commission, and selling 14 months later (long-term) at $165.00 per share with a $5.00 sell commission and a 15% long-term tax rate:

  1. Calculate Total Cost Basis: $$\text{Cost Basis} = (200 \times $120.00) + $5.00 = $24,000.00 + $5.00 = \mathbf{$24,005.00}$$
  2. Calculate Net Proceeds: $$\text{Net Proceeds} = (200 \times $165.00) - $5.00 = $33,000.00 - $5.00 = \mathbf{$32,995.00}$$
  3. Calculate Pre-Tax Profit & ROI: $$\text{Net Profit} = $32,995.00 - $24,005.00 = \mathbf{$8,990.00}$$ $$\text{ROI %} = \left( \frac{$8,990.00}{$24,005.00} \right) \times 100 = \mathbf{+37.45%}$$
  4. Calculate After-Tax Net Gain: $$\text{Tax Liability} = $8,990.00 \times 0.15 = \mathbf{$1,348.50}$$ $$\text{Final Take-Home Profit} = $8,990.00 - $1,348.50 = \mathbf{$7,641.50}$$

Practical Code Implementation: Stock Trading Calculation Suite

Below is a complete JavaScript engine handling equity trading mathematics, break-even targets, and tax partitioning:

/**
 * Equity Investment Profit & Tax Calculation Suite.
 */
class StockCalculator {
  static calculateTrade({
    shares,
    buyPrice,
    sellPrice,
    buyFee = 0,
    sellFee = 0,
    taxRatePercent = 0
  }) {
    if (shares <= 0 || buyPrice <= 0 || sellPrice <= 0) {
      throw new Error("Shares, buy price, and sell price must be positive numbers.");
    }

    const costBasis = (shares * buyPrice) + buyFee;
    const grossProceeds = shares * sellPrice;
    const netProceeds = grossProceeds - sellFee;
    const netProfit = netProceeds - costBasis;
    const roiPercent = (netProfit / costBasis) * 100;
    const breakevenPrice = ((shares * buyPrice) + buyFee + sellFee) / shares;

    let taxAmount = 0;
    if (netProfit > 0 && taxRatePercent > 0) {
      taxAmount = netProfit * (taxRatePercent / 100);
    }
    const afterTaxProfit = netProfit - taxAmount;

    return {
      costBasis: +costBasis.toFixed(2),
      netProceeds: +netProceeds.toFixed(2),
      netProfit: +netProfit.toFixed(2),
      roiPercent: +roiPercent.toFixed(2),
      breakevenPrice: +breakevenPrice.toFixed(2),
      taxAmount: +taxAmount.toFixed(2),
      afterTaxProfit: +afterTaxProfit.toFixed(2),
      isProfit: netProfit > 0
    };
  }
}

// Verification Example:
const trade = StockCalculator.calculateTrade({
  shares: 200,
  buyPrice: 120.00,
  sellPrice: 165.00,
  buyFee: 5,
  sellFee: 5,
  taxRatePercent: 15
});

console.log(`Pre-Tax Profit: $${trade.netProfit} (${trade.roiPercent}%)`);
console.log(`Break-Even Exit Price: $${trade.breakevenPrice}`);
console.log(`Take-Home After-Tax: $${trade.afterTaxProfit}`);

Comparison Matrix: Financial Trading Asset Classes

Asset ClassSettlement CycleTax AdvantagesTypical LeverageCounterparty Risk
Common Stocks (Equities)T+1 (Next Day)Long-term capital gains rates2:1 (Margin)Low (SIPC Insured)
Index ETFsT+1High tax efficiency (in-kind creation)1:1 to 3:1Low
Equity OptionsT+1High volatility; short-term ratesHigh (100x leverage)Moderate
Cryptocurrency SpotInstantTaxable on every swap1:1 to 50:1High (Uninsured exchanges)

Critical Edge Cases & Common Investor Traps

1. The IRS Wash-Sale Rule Violation (30-Day Window)

Under US Internal Revenue Code §1091, if an investor sells a stock at a loss and purchases "substantially identical" shares within 30 days before or after the sale:

  • The tax loss deduction is completely disallowed for that tax year.
  • The disallowed loss is added to the cost basis of the newly acquired shares, deferring the tax benefit until the new position is liquidated.

2. Corporate Actions & Stock Splits

If a stock executes a 2-for-1 forward stock split while in your portfolio, your share count doubles ($200 \to 400$) and your cost basis per share halves ($$120 \to $60$). Total cost basis remains identical, but calculations must reflect the adjusted share quantity.

3. The Currency Conversion Drag on Foreign ADRs

When trading American Depositary Receipts (ADRs) or foreign equities listed on international exchanges, foreign exchange conversion fees ($0.5% \text{ to } 2%$) and foreign dividend withholding taxes erode returns.

Frequently Asked Questions

What is the difference between short-term and long-term capital gains tax?
Assets held for 1 year or less are taxed at ordinary income rates (up to 37%), whereas assets held longer than 1 year qualify for preferential long-term rates (0%, 15%, or 20%).

Explore Related Utilities