✦ The Right Formula

How to Calculate XIRR

XIRR is the only formula that accounts for the exact dates and amounts of every cash flow. Here is how it works — and how XIRRLedger does it automatically from your broker ledger.

The XIRR Formula

∑ [ Cᵢ / (1 + XIRR)^(dᵢ/365) ] = 0

Where Cᵢ is each cash flow (negative for money in, positive for money out or current value) and dᵢ is the number of days from the first transaction. XIRR finds the rate that makes this sum equal zero — your true annualized return.

There is no shortcut formula. XIRR is solved by iteration — a computer runs hundreds of guesses until it converges. Excel has =XIRR() built in. So does XIRRLedger.

What Goes Into the Calculation

Every deposit is a cash outflow

Each time money enters your broker account — whether a fund transfer, SIP, or lump sum — it counts as money you paid. Date and amount both matter.

Jan 5, 2023 → −₹50,000

Every withdrawal is a cash inflow

When you take money out — profits, partial redemptions, dividend payouts — that is money coming back to you. XIRR records this too.

Aug 12, 2024 → +₹20,000

Current portfolio value closes the loop

Your holdings today are treated as if you withdrew everything right now. This is the terminal cash inflow that completes the calculation.

Today → +₹1,10,000 (current value)

XIRR finds the rate that makes it all balance

The XIRR formula iteratively finds the single annualized rate at which all your cash flows — in and out, on their exact dates — would produce exactly the outcome you got.

XIRR = 21.4% per year

Why the Ledger Is More Accurate Than Tracking Stocks

Most people try to calculate XIRR by listing their stock purchases and sales. This misses everything your broker and the government silently deduct from your account.

ChargeRateImpact
Brokerage₹20 per executed order (Zerodha flat fee)Adds up fast for active investors
STT (Securities Transaction Tax)0.1% on buy+sell for delivery, 0.025% on intraday sellLargest charge for most investors
Exchange Transaction Charges~0.003% of turnover (NSE/BSE)Small per trade, significant over years
GST18% on brokerage + exchange chargesGovernment tax on your transaction costs
Stamp Duty0.015% on buy value (delivery)State government levy
SEBI Turnover Fees₹10 per crore of turnoverVery small but still real

Your broker ledger already has all of this deducted

Every charge listed above appears as a debit in your ledger. When XIRRLedger reads your ledger, it sees the actual rupees that left your account — including every charge, tax, and fee. No manual adjustment needed. No risk of forgetting a line item.

How XIRRLedger Calculates Your XIRR

01

Reads your ledger

Parses your Zerodha CSV, Groww PDF, or Fyers CSV. Extracts every fund transfer in and out — with exact dates and amounts. All broker charges are already reflected in these cash flows.

02

Strips out noise

Ledger files contain hundreds of rows — stock purchases, sell proceeds, dividends, charges, quarterly settlements. XIRRLedger identifies which rows are actual cash flows into/out of your account and ignores everything else.

03

Adds your current value

You enter today's holdings value. This becomes the terminal cash inflow — as if you liquidated everything today. This closes the XIRR calculation.

04

Runs XIRR

The algorithm runs the iterative XIRR formula on your complete cash flow timeline. The result is your true annualized return — net of all charges, on exact dates.

05

Benchmarks against Nifty 50

The same cash flows are used to calculate what your return would have been if you had invested identically into Nifty 50. This tells you whether your stock picks beat the index.

Want to calculate it manually in Excel?

Read our detailed guide: Why Excel XIRR Gets It Wrong — and How the Ledger Method Fixes It →

Covers the full Excel method, common mistakes, and why tracking individual stocks misses ₹000s in charges.

Skip the spreadsheet

Upload your broker ledger and get your true XIRR — including all charges — in under 2 minutes.

Calculate Your XIRR Free