The three limbs
The exemption is not a single formula but a comparison. Each limb caps the exemption for a different reason: the first because you cannot exempt more allowance than you were paid, the second because only rent above a threshold is recognised, and the third because the framework limits relief to a proportion of salary.
Because the smallest limb wins, improving one of the other two changes nothing. That single fact explains most of the confusion around HRA.
Which salary the calculation uses
"Salary" here means basic pay plus the dearness allowance that forms part of retirement benefits, and any commission based on a fixed percentage of turnover where applicable. It is not your cost to company and not your gross pay. Using gross salary inflates the third limb and produces an exemption you cannot claim.
Metro and non-metro
The fifty per cent limb applies to Delhi, Mumbai, Kolkata and Chennai. Every other location uses forty per cent. The relevant place is where you rent and live, not where your employer is registered, so a remote employee paying rent in a smaller city uses the forty per cent limb.
Documentation and edge cases
Keep rent receipts, the rent agreement and proof of payment; landlord details are required above the prescribed rent threshold. Rent paid to a family member can be claimed only if the arrangement is genuine and documented. If you own the house you live in, there is no rent and therefore no exemption. And because this exemption belongs to the old-regime framework, factor it into your regime comparison rather than assuming it applies automatically.