Easily determine the average cost basis for your stock holdings.
Enter the price per share for the first purchase.
Enter the number of shares for the first purchase.
Enter the price per share for the second purchase.
Enter the number of shares for the second purchase.
Enter the price per share for the third purchase (optional).
Enter the number of shares for the third purchase (optional).
Enter the price per share for the fourth purchase (optional).
Enter the number of shares for the fourth purchase (optional).
Calculation Summary
Weighted Average Share Price
N/A
Key Intermediate Values
Total Cost of All Purchases: N/A
Total Number of Shares: N/A
Average Price Per Share (Simple): N/A
The Weighted Average Share Price is calculated by dividing the total cost of all share purchases by the total number of shares purchased. Formula: `(P1*S1 + P2*S2 + … + Pn*Sn) / (S1 + S2 + … + Sn)`.
Share Price vs. Weighted Average
Visualizing the contribution of each purchase to the weighted average.
Purchase Cost Breakdown
Showing the total cost attributed to each individual purchase.
Purchase Transaction Details
Purchase
Price Per Share
Shares Purchased
Total Cost
Enter data and click Calculate.
What is Weighted Average Share Price?
The Weighted Average Share Price, often referred to as the average cost basis, is a crucial metric for investors, particularly those who buy shares of the same stock multiple times at different prices. Instead of using a simple average of purchase prices, the weighted average share price accounts for the quantity of shares bought at each price point. This provides a more accurate representation of the true average cost per share you have paid for your total holdings.
Who Should Use It?
Any investor who engages in dollar-cost averaging or simply buys shares of a particular security at varying intervals and prices will benefit from understanding their weighted average share price. This includes:
Long-term investors accumulating a position over time.
Traders who re-enter a stock after selling portions of their holdings.
Retirement savers contributing regularly to investment accounts.
Anyone tracking their portfolio's performance and tax implications.
Common Misconceptions
A frequent mistake is to simply average the purchase prices of different lots of shares. For example, buying 100 shares at $10 and 200 shares at $12 is not an average of ($10 + $12) / 2 = $11. The larger quantity bought at $12 has a greater "weight" in the overall average. Another misconception is that the weighted average share price is always the same as the current market price; this is only true if you've only made one purchase or if all purchases were at the same price.
Weighted Average Share Price Formula and Mathematical Explanation
The calculation of the weighted average share price is straightforward once the concept of weighting is understood. It ensures that each purchase price contributes to the average in proportion to the number of shares acquired at that price.
The Formula
The core formula is:
Weighted Average Share Price = Total Cost of All Purchases / Total Number of Shares Purchased
Expanding this, if you have multiple purchase transactions (P1, P2, …, Pn) with corresponding share quantities (S1, S2, …, Sn), the formula becomes:
Positive number (usually between the min and max Pi)
The calculation effectively assigns a weight to each purchase price based on the number of shares bought. Prices at which more shares were purchased have a greater impact on the final weighted average share price.
Practical Examples (Real-World Use Cases)
Understanding the weighted average share price is most valuable when applied to common investment scenarios.
Example 1: Dollar-Cost Averaging in Tech Stocks
An investor, Sarah, believes in the long-term growth of a technology company. She decides to implement dollar-cost averaging.
Purchase 1: Buys 100 shares at $50.00 per share. Total Cost: $5,000.00
Purchase 2: Buys 150 shares at $55.00 per share. Total Cost: $8,250.00
Purchase 3: Buys 200 shares at $52.00 per share. Total Cost: $10,400.00
Weighted Average Share Price = $23,650.00 / 450 shares = $52.56 per share (approx.)
Interpretation: Sarah's average cost per share is approximately $52.56. This is not simply ($50 + $55 + $52) / 3 = $52.33 because she bought more shares at $55.00 and $52.00 than at $50.00.
Example 2: Rebalancing a Portfolio
David initially bought 500 shares of a dividend-paying stock at $30.00 per share. Later, he sold 200 shares for $45.00 each. A few months later, he bought 300 more shares at $40.00.
He sold 200 shares. The method for determining cost basis for sold shares (e.g., FIFO, LIFO, Average Cost) affects tax reporting. For calculating the remaining average cost basis, we assume the average cost method for simplicity of illustration.
Remaining Shares = 500 – 200 = 300 shares.
Average Cost Basis before sale: $15,000 / 500 = $30.00.
Current Holdings: 300 shares with a cost basis of $9,000.00 (average $30.00/share).
Purchase of New Shares: Buys 300 shares at $40.00. Total Cost = $12,000.00.
Calculation for New Weighted Average:
Total Cost = Remaining Cost Basis + Cost of New Shares = $9,000.00 + $12,000.00 = $21,000.00
Total Shares = Remaining Shares + New Shares = 300 + 300 = 600 shares
New Weighted Average Share Price = $21,000.00 / 600 shares = $35.00 per share
Interpretation: After the sale and subsequent purchase, David's average cost basis for his 600 shares is $35.00 per share.
How to Use This Weighted Average Share Price Calculator
Our Weighted Average Share Price Calculator is designed for simplicity and accuracy. Follow these steps to get your cost basis:
Step-by-Step Instructions
Input Purchase Prices: In the fields labeled "Purchase Price 1", "Purchase Price 2", etc., enter the exact price you paid per share for each batch of shares you acquired.
Input Shares Purchased: In the corresponding "Shares Purchased" fields, enter the number of shares you bought at each respective price.
Add More Transactions (Optional): If you have more than two purchase lots, continue filling in the "Purchase Price" and "Shares Purchased" fields for up to four transactions. The calculator handles optional fields gracefully.
Click "Calculate": Once you have entered all relevant purchase details, click the "Calculate" button.
Review Results: The calculator will immediately display:
The primary result: your Weighted Average Share Price.
Key intermediate values: Total Cost of All Purchases, Total Number of Shares, and a Simple Average Price Per Share for comparison.
A detailed table of your transaction inputs.
Visualizations: Charts showing the cost breakdown and price dynamics.
Use "Copy Results": Click the "Copy Results" button to copy the summary of your calculation, including key assumptions and the main result, to your clipboard.
Use "Reset": To clear all fields and start over, click the "Reset" button. It will restore sensible default values for quick reuse.
How to Read Results
The Weighted Average Share Price is the most important figure. It represents your true average cost per share, considering all your buy orders. Compare this to the "Average Price Per Share (Simple)" to see the impact of volume weighting. The total cost and total shares give you the overall financial commitment to that specific security.
Decision-Making Guidance
Your weighted average share price is a cornerstone for several financial decisions:
Profit/Loss Calculation: Subtract your weighted average share price from the current market price to determine your unrealized gain or loss per share.
Tax Implications: When selling shares, knowing your cost basis is essential for calculating capital gains or losses for tax purposes. Different tax lots might have different basis depending on accounting methods (FIFO, LIFO, Average Cost). This calculator primarily provides the average cost basis.
Rebalancing Strategy: If the stock has appreciated significantly above your weighted average, you might consider trimming the position. If it has fallen, it could represent a buying opportunity to lower your average cost.
Key Factors That Affect Weighted Average Share Price Results
While the calculation itself is mathematical, several real-world financial factors influence the inputs and their interpretation:
Purchase Price Volatility: The wider the range between your highest and lowest purchase prices, the more significant the "weighting" effect will be. Large price swings mean each share quantity carries more or less impact on the average.
Transaction Volume: This is the direct weighting factor. Buying a large number of shares at a high price will pull the average up significantly, while buying many shares at a low price will drag it down.
Timing of Purchases: Purchasing shares more frequently over a long period, especially during market fluctuations, will naturally lead to a more complex calculation and a weighted average that reflects market conditions over time.
Brokerage Fees and Commissions: Although often negligible with modern brokers, any fees associated with a purchase should ideally be added to the purchase price to get a true cost basis. This calculator assumes zero fees for simplicity, but real-world calculations might need to adjust for them.
Dividend Reinvestment Plans (DRIPs): When dividends are automatically reinvested to buy more shares, these are effectively new purchases. The price at which these shares are bought (often at a discount or without commission) needs to be factored into the total cost and share count, influencing the weighted average.
Stock Splits and Reverse Splits: A stock split (e.g., 2-for-1) increases the number of shares you own but divides the price by the split ratio, keeping the total cost and weighted average the same initially. A reverse split does the opposite. These events adjust the share count and price basis accordingly.
Wash Sale Rules: For tax purposes, if you sell a security at a loss and buy a substantially identical one within 30 days before or after the sale, the loss is disallowed. This rule can complicate the calculation of cost basis for subsequent purchases if not carefully managed.
Frequently Asked Questions (FAQ)
Q1: What is the difference between a simple average and a weighted average share price?
A simple average adds up all purchase prices and divides by the number of purchases. A weighted average accounts for the quantity of shares bought at each price, giving more importance to purchases with larger share volumes.
Q2: Why is the weighted average share price important for taxes?
When you sell shares, you must report the capital gain or loss. This is calculated as Selling Price – Cost Basis. The weighted average share price often serves as the cost basis per share for the entire lot, simplifying tax reporting, though specific tax lots might be tracked individually.
Q3: Does this calculator include brokerage fees?
This calculator assumes purchase prices are net of fees for simplicity. In real-world scenarios, you should add any brokerage commissions or fees to the purchase price of each transaction to get a more accurate cost basis.
Q4: What happens if I sell some shares? Does the weighted average change?
When you sell shares, your total number of shares decreases, and the total cost basis reduces. How you calculate the cost basis of the *sold* shares (e.g., FIFO, LIFO, average cost) affects your immediate capital gain/loss. The weighted average of your *remaining* shares will then be recalculated based on the remaining total cost basis and remaining shares.
Q5: Can I use this for cryptocurrencies or other assets?
Yes, the principle of weighted average applies to any asset that can be bought in multiple lots at different prices, including cryptocurrencies, ETFs, mutual funds, and commodities.
Q6: What if I have many small purchases?
The calculator supports up to four purchase lots. For more than four, you can group similar purchases or perform the calculation in stages. For instance, sum up the total cost and shares for two small purchases, then enter that sum as one transaction in the calculator.
Q7: How do stock splits affect the weighted average share price?
A stock split (e.g., 2-for-1) increases your share count by the split ratio but decreases your per-share price by the same ratio. The total cost basis remains the same, so the weighted average share price theoretically stays the same immediately after the split. You'll need to adjust your input numbers to reflect the post-split share counts and prices.
Q8: Is the weighted average share price the same as the market price?
No. The market price is the current trading price of the stock. Your weighted average share price is your historical average cost of acquiring the shares you currently hold.
Related Tools and Internal Resources
Investment Return CalculatorCalculate the total return on your investments, considering capital gains and dividends.
';
document.getElementById('summaryForCopy').innerHTML = summaryHtml;
document.querySelector('.formula-explanation').textContent = 'The Weighted Average Share Price is calculated by dividing the total cost of all share purchases by the total number of shares purchased. Formula: (P1*S1 + P2*S2 + … + Pn*Sn) / (S1 + S2 + … + Sn).';
}
// Initial calculation on load with default values
window.onload = function() {
resetCalculator(); // Set default values and trigger calculation
calculateWeightedAverage(); // Calculate based on default values
};
// Add event listeners for real-time updates
var inputFields = document.querySelectorAll('.loan-calc-container input');
for (var i = 0; i < inputFields.length; i++) {
inputFields[i].addEventListener('input', function() {
calculateWeightedAverage();
});
}