Calculate your stock dividend yield and project future value with reinvestment (DRIP).
Yes, Reinvest (Compound)
No, Take Cash
Dividend Yield:0.00%
Initial Annual Income:$0.00
Total Dividends Earned:$0.00
Ending Share Count:0
Total Portfolio Value:$0.00
function calculateDividend() {
// 1. Get Elements
var stockPriceInput = document.getElementById('stockPrice');
var annualDivInput = document.getElementById('annualDiv');
var numSharesInput = document.getElementById('numShares');
var holdYearsInput = document.getElementById('holdYears');
var dripSelect = document.getElementById('drip');
var resultsDiv = document.getElementById('results');
// 2. Parse Values
var price = parseFloat(stockPriceInput.value);
var dividend = parseFloat(annualDivInput.value);
var shares = parseFloat(numSharesInput.value);
var years = parseInt(holdYearsInput.value);
var isDrip = dripSelect.value === 'yes';
// 3. Validation
if (isNaN(price) || price <= 0) {
alert("Please enter a valid Stock Price greater than 0.");
return;
}
if (isNaN(dividend) || dividend < 0) {
alert("Please enter a valid Annual Dividend.");
return;
}
if (isNaN(shares) || shares < 0) {
shares = 0; // Default to 0 if empty
}
if (isNaN(years) || years < 1) {
years = 1; // Default to 1 year
}
// 4. Calculate Basic Yield
var yieldPercent = (dividend / price) * 100;
var initialAnnualIncome = dividend * shares;
// 5. Calculate Projection (Future Value)
var currentShares = shares;
var totalDividendsReceived = 0;
var accumulatedCash = 0;
// We assume stock price stays constant for the dividend yield pure calculation
// to show the power of income accumulation specifically.
for (var i = 0; i < years; i++) {
var yearDividendIncome = currentShares * dividend;
if (isDrip) {
// Reinvest: Buy more shares
var sharesPurchased = yearDividendIncome / price;
currentShares += sharesPurchased;
totalDividendsReceived += yearDividendIncome;
} else {
// No Reinvest: Collect cash
accumulatedCash += yearDividendIncome;
totalDividendsReceived += yearDividendIncome;
}
}
// Final Portfolio Value
// If DRIP: Value is final shares * price
// If No DRIP: Value is (original shares * price) + cash collected
var finalPortfolioValue = 0;
if (isDrip) {
finalPortfolioValue = currentShares * price;
} else {
finalPortfolioValue = (shares * price) + accumulatedCash;
}
// 6. Update HTML Results
document.getElementById('resYield').innerHTML = yieldPercent.toFixed(2) + '%';
document.getElementById('resAnnualInc').innerHTML = '$' + initialAnnualIncome.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('resTotalDivs').innerHTML = '$' + totalDividendsReceived.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('resEndShares').innerHTML = currentShares.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('resTotalValue').innerHTML = '$' + finalPortfolioValue.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
// Show results
resultsDiv.style.display = 'block';
}
Understanding Dividend Yield
Dividend yield is a financial ratio that tells you how much a company pays out in dividends each year relative to its stock price. It is one of the most critical metrics for income-focused investors who prioritize steady cash flow over rapid capital appreciation.
The yield is expressed as a percentage, allowing you to compare the income-generating potential of different stocks regardless of their share price.
The Dividend Yield Formula
The calculation is straightforward:
Dividend Yield = (Annual Dividend per Share / Current Share Price) × 100
For example, if a stock trades at $50.00 and pays an annual dividend of $2.50 per share, the yield is 5.00%.
Why Use a Dividend Calculator?
While the basic yield is easy to calculate mentally, projecting long-term returns requires more complex math, especially when you factor in Dividend Reinvestment Plans (DRIP).
Income Projection: See exactly how much passive income you will generate annually based on your current holdings.
The Power of Compounding: Our calculator demonstrates how reinvesting your dividends (DRIP) buys more shares, which in turn pay more dividends, creating a snowball effect over time.
Portfolio Planning: Helps determine how many shares you need to own to reach a specific monthly or annual income goal.
Real-World Example: Compounding in Action
Let's assume you invest $10,000 in a stable utility company.
Share Price: $100
Shares Owned: 100
Annual Dividend: $4.00 (4% Yield)
Scenario A (No Reinvestment): You take the cash. Over 10 years, you collect $4,000 in dividends. Your total value is $14,000 (assuming no stock price change).
Scenario B (With DRIP): You reinvest the dividends to buy more shares. In Year 1, you buy 4 new shares. In Year 2, you have 104 shares paying dividends. By the end of Year 10, thanks to compounding, your total value would be approximately $14,802, and you would own about 148 shares instead of the original 100.
What is a "Good" Dividend Yield?
A "good" yield depends on the sector and market conditions:
Tech Stocks (0.5% – 1.5%): Often lower because these companies reinvest profits into growth rather than payouts.
Blue Chip / Consumer Goods (2% – 4%): Considered the "sweet spot" for stability and income (e.g., Coca-Cola, Johnson & Johnson).
REITs and Utilities (4% – 8%): Typically higher because these entities are required by law to distribute a large percentage of taxable income to shareholders.
Warning: Extremely high yields (over 8-10%) can sometimes be a "dividend trap," indicating that the stock price has plummeted due to financial trouble, and the dividend may soon be cut.