Stock Average Cost Calculator
Calculate your volume-weighted average price (dollar-cost average) across multiple stock purchase lots.
Calculate your weighted average cost per share when buying a stock at multiple different prices over time. Input multiple buy lots to determine your true cost basis and current unrealized return.
How this calculator works
Average Price Per Share = Sum(Shares_i * Price_i) / Sum(Shares_i). Total Cost Basis = Sum(Shares_i * Price_i).
Key benefits
- Supports up to 5 distinct purchase lots with custom share counts and prices
- Instantly calculates your true weighted break-even price per share
- Shows unrealized paper gain or loss against current market price
- Essential for dollar-cost averaging into volatile stocks, ETFs, and index funds
Assumptions & exclusions
- Assumes all lots belong to the same share class and asset ticker.
Frequently asked questions
How does average cost basis differ from FIFO or LIFO when selling?
For individual stocks in the US, the IRS requires specific identification or First-In-First-Out (FIFO) by default. Average cost basis is primarily allowed for mutual funds, though many investors track average cost to evaluate their overall position performance.
Does buying more shares at a lower price always reduce my average cost?
Yes, mechanically: any purchase below your current average pulls the weighted average down, and any purchase above it pulls it up. How much it moves depends on the size of the new lot relative to the position you already hold, so a small top-up barely changes the average of a large existing position.
Should I average down on a stock that has fallen?
Averaging down lowers your break-even price, but it also concentrates more money in a holding the market is repricing, sometimes for good reason. It makes sense only when your original case for the company still holds on current evidence. A lower average cost is arithmetic, not proof that the additional purchase was wise.
How are fractional shares handled in average cost?
The same way as whole shares: their cost is added to the total basis and their fraction is added to the total share count. Dividend reinvestment plans commonly create fractional shares, and including those small lots keeps your average cost and share count aligned with your actual brokerage position.
Why does my broker show a different average cost than I calculate?
Small differences usually come from commissions, which many broker displays fold into the basis while this page's lots do not, or from corporate actions such as splits and reinvested dividends that adjusted the broker's records. For tax purposes the broker's official cost-basis statement is the figure to rely on.
What happens to my average cost when a stock splits?
A split changes the share count and the per-share price in the same proportion, leaving your total cost basis unchanged. After a 2-for-1 split you hold twice as many shares at half the average cost per share. If you enter lots from before and after a split, adjust the older prices so all lots are on the same basis.
Formula-Based Calculator · By QalcTools Editorial Team. Formulas tested against independent reference values · Content reviewed November 2026 by the QalcTools Editorial Team.
Methodology note: Volume-weighted arithmetic mean formulation across discrete investment tranches.
Related calculators
- Dollar Cost Averaging Calculator (DCA)
- Stock Calculator
- Stock Profit Calculator
- Capital Gains Calculator
Category: Investments & Retirement Calculators
About this calculator
Few investors buy all their shares on one day at one price. Purchases accumulate — some before a rise, some after a dip — and the honest summary of that history is a single weighted figure: what the average share actually cost you, weighted by how many shares were bought at each price. This calculator builds that figure from up to five purchase lots and sets it against the current market price, so you can see your true break-even level and the size of the gain or loss across the whole position, rather than anchoring on whichever purchase you happen to remember best.
How it works
Add a lot for each purchase: the number of shares and the price paid for that batch. The tool multiplies shares by price inside every lot and adds those products together to get the total cost basis, then adds the share counts to get the position size. Dividing total cost by total shares produces the weighted average price — weighted, because a 200-share lot moves the average four times as much as a 50-share lot at the same price. Enter a current market price and the tool values the full position at it, showing the unrealized gain or loss in dollars and percent against that average-cost basis.
The formula, explained
Average price = Σ(Shares per lot × Price per lot) ÷ Σ(Shares per lot); Unrealized gain = Total shares × Current price − Total cost basis
- Σ(Shares × Price) — Total cost basis: the dollar cost of every lot added together ($)
- Σ Shares — Total shares across all lots — the size of the position (shares)
- Average price — Volume-weighted cost per share across the whole position ($/share)
- Current price — Market price you enter to value the position today ($/share)
The engine floors each lot’s shares and price at zero, sums shares times price across the lots you supply, and divides by the total share count, rounding the average price to three decimals and money totals to cents. When a current market price is supplied it values the position, subtracts the basis for the unrealized gain or loss, and expresses it as a percentage of the basis. Note what the engine does not add: commissions are not part of this page’s lots, so the basis here is share cost only. The form supports adding lots beyond the three shown by default.
Inputs and variables
| Variable | Meaning | Example |
|---|---|---|
| Shares in Each Lot | How many shares that particular purchase added. Lot size is the weight in the average, so a large cheap lot pulls the average down more than a small one. | 50 shares in lot 1 |
| Purchase Price of Each Lot | The per-share price paid in that purchase, taken from the trade confirmation for that date — each lot keeps its own price. | $140.00 in lot 1 |
| Number of Purchase Lots | How many separate buys make up the position. The page starts with three lots and lets you add more, up to five in the record’s design. | 3 lots |
| Current Market Price per Share | Today’s price, used only to value the position and size the unrealized result. Changing it moves the gain or loss, never the average cost. | $180.00 |
Worked example
An investor built a position in three buys — 50 shares at $140, 30 shares at $155 and 20 shares at $170 — and the stock now trades at $180.
- Lot 1: 50 shares at $140
- Lot 2: 30 shares at $155
- Lot 3: 20 shares at $170
- Current market price: $180.00
- Lot costs: 50 × $140 = $7,000; 30 × $155 = $4,650; 20 × $170 = $3,400. Total cost basis: $15,050 across 100 shares.
- Weighted average price: $15,050 ÷ 100 = $150.50 per share — below the simple average of the three prices ($155), because the largest lot was the cheapest.
- Position value at $180: 100 × $180 = $18,000.
- Unrealized gain: $18,000 − $15,050 = $2,950, which is 19.60% of the cost basis.
An average cost of $150.50 per share on 100 shares with a $15,050 cost basis, currently worth $18,000 — an unrealized gain of $2,950 (19.60%).
The weighted figure tells a calmer story than any single lot: the $170 purchase looks careless in isolation, yet the position as a whole breaks even at $150.50, comfortably below today’s price. That is the level decisions should reference — selling below it loses money overall, whatever one lot did. Notice also how the weighting protected the average: because half the shares were bought at the lowest price, the later, smaller buys at higher prices moved the average only modestly.
Understanding your results
The average price is a break-even line for the position taken as a whole. Above it, the position is ahead; below it, behind — regardless of the order the lots were bought in. That makes it the natural reference for hold-or-sell decisions and for judging a new purchase: adding shares below the current average lowers it, adding above raises it, and the size of the new lot decides how much it moves.
Keep the tax view separate from this performance view. The average cost summarizes your economics, but when shares are actually sold, tax rules generally work lot by lot — by specific identification or first-in, first-out by default for individual stocks — so the gain on a particular sale may not match the position’s average picture. Use this page to judge the investment, and your brokerage’s lot records to judge the tax.
Assumptions and limitations
The basis built here is share cost only: the lots on this page carry no commission fields, so small trading fees are excluded and the true break-even sits a fraction higher than the average shown. The page also values the whole position at one current price you type in — it fetches no live quote — and it assumes every lot is the same share class of the same holding. Positions built through dividend reinvestment, employee plans or more lots than the form holds will need the extra purchases summarized before they can be represented. For tax reporting, rely on your broker’s cost-basis records rather than this summary.
Common mistakes to avoid
- Averaging the prices instead of weighting them. The plain mean of $140, $155 and $170 is $155, but the position’s real average is $150.50 because the biggest lot was cheapest. Share counts are the weights.
- Anchoring on the most recent purchase. The last lot is the most memorable, not the most representative. Judging the position by the $170 lot alone misreads a position that is ahead overall.
- Assuming average cost settles the tax bill. Tax on a sale usually follows the specific lots sold or the default ordering rules, not the blended average. The two numbers serve different purposes.
- Forgetting reinvested dividends add lots. Shares bought automatically through a reinvestment plan are purchases too. Leaving them out understates both the share count and the basis.
- Believing averaging down fixes a bad holding. Buying more lowers the average cost mechanically, but it also concentrates more money in the same name. A lower average is arithmetic, not a verdict on the company.