{
  "id": "stock-profit",
  "version": "15351c6f770f",
  "status": "published",
  "name": "Stock Profit Calculator",
  "question": "What is my stock profit?",
  "summary": "Computes the profit or loss and the return on shares bought and sold at prices you type, after commissions and with dividends, and the annualized return and holding period when you add the dates.",
  "category": "finance",
  "subcategory": "investing",
  "url": "https://www.acalculator.org/finance/stock-profit-calculator",
  "markdown": "https://www.acalculator.org/finance/stock-profit-calculator.md",
  "kind": "function",
  "method": "Profit = (shares × sell price − commission to sell) + dividends − (shares × buy price + commission to buy); return = profit ÷ total cost × 100.",
  "assumptions": [
    "Prices are what you type; nothing is looked up.",
    "Commissions are dollar amounts for the whole trade.",
    "Taxes are not taken out. Long-term and short-term follow the one-year rule of IRS Publication 550.",
    "This is an estimate, not tax or investment advice."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "shares": {
        "title": "Number of shares",
        "description": "How many shares you bought and sold. Fractional shares are fine.",
        "type": "number",
        "exclusiveMinimum": 0,
        "maximum": 1000000000
      },
      "buy": {
        "title": "Buy price per share",
        "description": "The price you paid for each share.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 10000000
      },
      "sell": {
        "title": "Sell price per share",
        "description": "The price you sold each share for, or the price you expect to sell at.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 10000000
      },
      "buyfee": {
        "title": "Commission to buy",
        "description": "Commissions and fees paid on the purchase, in dollars for the whole trade.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000
      },
      "sellfee": {
        "title": "Commission to sell",
        "description": "Commissions and fees paid on the sale, in dollars for the whole trade.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000
      },
      "div": {
        "title": "Dividends received",
        "description": "All the cash dividends you received while you held the shares, in dollars.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000000
      },
      "bought": {
        "title": "Date bought",
        "description": "The trade date of the purchase. Add both dates for the annualized return and the holding period.",
        "type": "string",
        "format": "date"
      },
      "sold": {
        "title": "Date sold",
        "description": "The trade date of the sale.",
        "type": "string",
        "format": "date"
      }
    }
  },
  "outputs": {
    "profit": {
      "label": "Profit or loss",
      "description": "Net sale proceeds plus dividends minus the total cost. Negative for a loss.",
      "format": "money"
    },
    "roi": {
      "label": "Return",
      "description": "The profit as a percent of the total cost.",
      "format": "percent"
    },
    "cost": {
      "label": "Total cost",
      "description": "Shares × buy price plus the commission to buy: your cost basis.",
      "format": "money"
    },
    "proceeds": {
      "label": "Net sale proceeds",
      "description": "Shares × sell price minus the commission to sell.",
      "format": "money"
    },
    "breakEven": {
      "label": "Break-even sell price",
      "description": "The sell price per share that gives a profit of exactly $0.",
      "format": "money"
    },
    "change": {
      "label": "Share price change",
      "description": "The sell price minus the buy price, as a percent of the buy price.",
      "format": "percent"
    },
    "days": {
      "label": "Days held",
      "description": "Calendar days from the buy date to the sell date.",
      "format": "integer"
    },
    "annualized": {
      "label": "Annualized return",
      "description": "The yearly rate that gives the same return over the days held: (1 + return)^(365 ÷ days) − 1.",
      "format": "percent"
    },
    "term": {
      "label": "Holding period",
      "description": "Long-term when the shares were held more than one year, short-term otherwise (IRS rule).",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "shares": 100,
      "buy": 50,
      "sell": 65,
      "buyfee": 0,
      "sellfee": 0,
      "div": 0
    },
    "outputs": {
      "profit": 1500,
      "roi": 30,
      "cost": 5000,
      "proceeds": 6500,
      "breakEven": 50,
      "change": 30
    },
    "text": "Buying 100 shares at $50.00 and selling at $65.00 gives a profit or loss of $1,500.00."
  },
  "examples": [
    {
      "given": {
        "shares": 100,
        "buy": 50,
        "sell": 65,
        "buyfee": 10,
        "sellfee": 10
      },
      "expect": {
        "profit": 1480,
        "cost": 5010,
        "proceeds": 6490,
        "roi": 29.540918163672654,
        "breakEven": 50.2,
        "change": 30
      },
      "source": "IRS Publication 550: basis includes the purchase commission and the amount realized is the sale price minus selling expenses (https://www.irs.gov/publications/p550); hand calculation in content.mdx"
    },
    {
      "given": {
        "shares": 40,
        "buy": 120.35,
        "sell": 98.1,
        "buyfee": 4.95,
        "sellfee": 4.95,
        "div": 18.4
      },
      "expect": {
        "profit": -881.5,
        "cost": 4818.95,
        "proceeds": 3919.05,
        "roi": -18.292366594382592,
        "breakEven": 120.1375
      },
      "source": "IRS Publication 550, basis and amount realized (https://www.irs.gov/publications/p550); hand calculation in content.mdx"
    },
    {
      "given": {
        "shares": 10,
        "buy": 100,
        "sell": 121,
        "bought": "2024-03-01",
        "sold": "2026-03-01"
      },
      "expect": {
        "profit": 210,
        "roi": 21,
        "days": 730,
        "annualized": 10,
        "term": "Long-term"
      },
      "source": "IRS Publication 550, holding period: more than 1 year is long-term (https://www.irs.gov/publications/p550); hand calculation in content.mdx"
    },
    {
      "given": {
        "shares": 10,
        "buy": 100,
        "sell": 110,
        "bought": "2025-01-15",
        "sold": "2026-01-15"
      },
      "expect": {
        "days": 365,
        "annualized": 10,
        "term": "Short-term"
      },
      "source": "IRS Publication 550, holding period: count from the day after you bought through the day you sold (https://www.irs.gov/publications/p550); hand calculation in content.mdx"
    }
  ],
  "sources": [
    "Internal Revenue Service, Publication 550, Investment Income and Expenses: basis, amount realized, and holding period. https://www.irs.gov/publications/p550",
    "U.S. Securities and Exchange Commission, Investor.gov: Understanding fees. https://www.investor.gov/introduction-investing/getting-started/understanding-fees"
  ],
  "related": [
    "stock",
    "stock-average",
    "crypto-profit",
    "roi",
    "dividend"
  ],
  "changelog": []
}
