Time-weighted Rate of Return Calculator

Time-Weighted Rate of Return Calculator body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; line-height: 1.6; color: #333; max-width: 100%; margin: 0; padding: 0; } .calculator-container { max-width: 800px; margin: 20px auto; padding: 30px; background: #ffffff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); border: 1px solid #e0e0e0; } .calc-header { text-align: center; margin-bottom: 30px; background: #f8f9fa; padding: 20px; border-radius: 8px; border-left: 5px solid #2c3e50; } .calc-header h2 { margin: 0 0 10px 0; color: #2c3e50; } .calc-header p { margin: 0; color: #666; font-size: 0.95em; } .input-section { margin-bottom: 25px; } .input-group { margin-bottom: 15px; } .period-row { display: flex; flex-wrap: wrap; gap: 15px; padding: 15px; background: #fdfdfd; border: 1px solid #eee; border-radius: 6px; margin-bottom: 10px; align-items: flex-end; } .period-label { width: 100%; font-weight: 600; color: #2c3e50; margin-bottom: 5px; border-bottom: 1px solid #eee; padding-bottom: 5px; } .input-col { flex: 1; min-width: 200px; } label { display: block; font-weight: 500; margin-bottom: 5px; color: #555; font-size: 0.9em; } input[type="number"] { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 16px; box-sizing: border-box; transition: border-color 0.3s; } input[type="number"]:focus { border-color: #3498db; outline: none; } .help-text { font-size: 0.8em; color: #888; margin-top: 3px; } .calc-btn { display: block; width: 100%; padding: 15px; background: #2c3e50; color: white; border: none; border-radius: 6px; font-size: 18px; font-weight: 600; cursor: pointer; transition: background 0.2s; margin-top: 20px; } .calc-btn:hover { background: #34495e; } #result-area { margin-top: 30px; padding: 25px; background: #f1f8ff; border-radius: 8px; border: 1px solid #d1e3f6; display: none; } .result-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 1px solid #e1eaf7; padding-bottom: 10px; } .result-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; } .result-label { font-size: 1.1em; color: #2c3e50; } .result-value { font-size: 1.5em; font-weight: 700; color: #27ae60; } .sub-result { font-size: 1.2em; color: #2980b9; } .article-content { max-width: 800px; margin: 40px auto; padding: 20px; line-height: 1.7; color: #444; } .article-content h2 { color: #2c3e50; border-bottom: 2px solid #eee; padding-bottom: 10px; margin-top: 30px; } .article-content h3 { color: #34495e; margin-top: 25px; } .article-content ul, .article-content ol { margin-left: 20px; margin-bottom: 20px; } .article-content li { margin-bottom: 10px; } .info-box { background: #fff3cd; border-left: 5px solid #ffc107; padding: 15px; margin: 20px 0; } @media (max-width: 600px) { .period-row { flex-direction: column; gap: 10px; } .input-col { width: 100%; } }

TWRR Calculator

Calculate the Time-Weighted Rate of Return for your investment portfolio.

The value of the portfolio at the very beginning.

Period 1
Period 2
Period 3
Period 4
Cumulative TWRR: 0.00%
Final Portfolio Value: $0.00
Period Breakdown:

    Understanding Time-Weighted Rate of Return

    The Time-Weighted Rate of Return (TWRR) is the standard method used in the investment industry to measure the performance of a portfolio. Unlike simple return calculations, TWRR eliminates the distorting effects of cash inflows (deposits) and outflows (withdrawals).

    Why it matters: If you deposit a large sum of money into your account right before a market rally, a simple return calculation would artificially inflate your performance percentage. TWRR separates the timing of your cash flows from the actual investment performance.

    How TWRR is Calculated

    The calculation involves breaking down the investment horizon into sub-periods based on when cash flows occur. For each sub-period, a Holding Period Return (HPR) is calculated. These returns are then geometrically linked (compounded) to determine the total return.

    The formula for a single period return is:

    HPR = (End Value – (Start Value + Net Cash Flow)) / (Start Value + Net Cash Flow)

    Or more simply derived from growth factors:

    Growth Factor = End Value / (Start Value + Net Cash Flow)

    The total TWRR is calculated by multiplying these Growth Factors:

    TWRR = [(Factor 1) × (Factor 2) × … × (Factor n)] – 1

    Example Calculation

    Imagine an investor starts with $100,000.

    1. Period 1: The portfolio grows to $105,000. The investor then deposits $10,000.
      Return: ($105,000 – $100,000) / $100,000 = 5.0%
    2. Period 2: Starting with $115,000 ($105k + $10k), the portfolio drops to $110,000.
      Return: ($110,000 – $115,000) / $115,000 = -4.35%

    The Money-Weighted return might look effectively flat, but TWRR links the periods:
    (1 + 0.05) × (1 – 0.0435) – 1 = 0.43% Total Return.

    TWRR vs. Money-Weighted Return (IRR)

    While TWRR isolates investment skill, Money-Weighted Return (or IRR) measures the actual growth of the client's money, heavily influenced by the timing of deposits. Use TWRR to compare funds or managers; use IRR to understand your personal wealth growth.

    function calculateTWRR() { // 1. Get Initial Value var initialVal = parseFloat(document.getElementById('initialValue').value); if (isNaN(initialVal)) { alert("Please enter a valid Starting Portfolio Value."); return; } // 2. Initialize Variables var cumulativeGrowth = 1.0; var currentStart = initialVal; var breakdownHTML = ""; var periodsFound = false; var finalValue = initialVal; // 3. Loop through 4 periods for (var i = 1; i <= 4; i++) { var flowId = "p" + i + "Flow"; var endId = "p" + i + "End"; var cashFlow = parseFloat(document.getElementById(flowId).value); var endValue = parseFloat(document.getElementById(endId).value); // Treat empty inputs as 0 for flow, check validity for End Value if (isNaN(cashFlow)) cashFlow = 0; // If endValue is entered, process this period if (!isNaN(endValue)) { periodsFound = true; // Invested Amount = Start of Period + Cash Flow occurring at start/during // Note: Standard Modified Dietz often assumes flow is weighted, // but for simple sub-period linking (True TWRR), we assume flow happens before measurement of end value. var investedCapital = currentStart + cashFlow; if (investedCapital === 0) { breakdownHTML += "
  • Period " + i + ": Skipped (Zero capital invested)
  • "; currentStart = endValue; // Reset for next period continue; } // Calculate Growth Factor for this period // Growth Factor = Ending Value / (Beginning Value + Cash Flow) var growthFactor = endValue / investedCapital; var periodReturn = (growthFactor – 1) * 100; // Update Cumulative Growth cumulativeGrowth *= growthFactor; // Log breakdown breakdownHTML += "
  • Period " + i + ": " + "Start $" + currentStart.toLocaleString() + " + Flow $" + cashFlow.toLocaleString() + " → End $" + endValue.toLocaleString() + " (" + periodReturn.toFixed(2) + "%)
  • "; // Set up next period start currentStart = endValue; finalValue = endValue; } } if (!periodsFound) { alert("Please fill in at least Period 1 details."); return; } // 4. Final Calculations var totalTwrr = (cumulativeGrowth – 1) * 100; // 5. Display Results document.getElementById('totalTwrr').innerHTML = totalTwrr.toFixed(2) + "%"; document.getElementById('finalValueDisplay').innerHTML = "$" + finalValue.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}); document.getElementById('breakdownList').innerHTML = breakdownHTML; // Show result area document.getElementById('result-area').style.display = 'block'; }

    Leave a Comment