induwara.lk
induwara.lkAI · Machine learning

Mean Reciprocal Rank (MRR) Calculator

Paste the first-hit rank of each query, or a 0/1 relevance list per query, and get MRR with every reciprocal rank and the full arithmetic shown. The standard information-retrieval / TREC definition. No signup, nothing uploaded.

By Induwara AshinsanaUpdated Jun 10, 2026
Mean Reciprocal Rank calculator
Input mode

The rank (1, 2, 3, …) at which the first relevant result appeared for each query. Separate with commas, spaces or new lines. Use 0 or none for a query with no relevant result.

Examples
MRR
0.6111
0 to 1 · higher is better
Σ reciprocal ranks
1.8333
sum of 1/rankᵢ
Q (queries)
3
all returned a relevant result
Reading
Good ranking
MRR61.11% of the maximum

The arithmetic

MRR = (1/Q) · Σ (1/rankᵢ)
= (1/3) · (1/3 + 1/2 + 1/1)
= 1.8333 / 3
MRR = 0.6111

Cross-check. Summing the reciprocal ranks in input order gives 0.6111; an independent pass that sums them smallest-first gives 0.6111. They reconcile, as they must.

Per-query working

QueryFirst-hit rankRRᵢ = 1/rank
#130.3333
#220.5000
#311.0000
Σ reciprocal ranks1.8333

Method: MRR = (1/Q) · Σ 1/rankᵢ, where rankᵢ is the position of the first relevant result for query i and a no-hit query scores 0 — the standard information-retrieval / TREC QA definition (Voorhees 1999; Manning et al., §8). Nothing leaves this page.

How it works

Mean Reciprocal Rank (MRR) measures how high up a ranked list the firstrelevant result appears, averaged over a set of queries. It is the headline metric for tasks that have one correct answer to find quickly — question answering, known-item search, entity lookup, and the retrieval step of a RAG pipeline. The definition here follows Voorhees (1999), who introduced MRR as the official score of the TREC-8 Question Answering track, and Manning, Raghavan & Schütze, §8.

Positions are 1-indexed. For each query i, let rankᵢ be the position of the first relevant result. The score is built in three steps:

  1. Reciprocal rank. Take RRᵢ = 1 / rankᵢ. A first hit at rank 1 scores 1, rank 2 scores 0.5, rank 3 scores about 0.333 — the reward drops off quickly as the first relevant result sinks lower.
  2. No-hit convention. If a query returns no relevant result at all, RRᵢ = 0 (Voorhees, 1999). The query still counts toward Q, so misses pull the average down rather than being ignored.
  3. Average. Add the reciprocal ranks and divide by the number of queries: MRR = (1/Q) · Σᵢ 1/rankᵢ, a value in [0, 1].

The two input modes are equivalent. In ranks mode you type the position directly. In relevance-list mode you give a 0/1 list per query and the tool finds the first 1 from the left, so 0, 0, 1 is read as rank 3, identical to typing 3; an all-zero line is a no-hit. Because MRR depends only on the first relevant position, anything below it is irrelevant to the score — that is exactly the difference from NDCG, which grades and discounts the whole list. As a credibility check, the calculator computes the average a second way — summing the reciprocal ranks smallest-first rather than in input order — and confirms the two routes agree to floating-point precision. Everything is deterministic and runs entirely in your browser.

Worked examples

Standard — first-hit ranks [3, 2, 1]

  1. RR = 1/3, 1/2, 1/1 = 0.3333333, 0.5, 1
  2. Σ RR = 1.8333333, Q = 3
  3. MRR = 1.8333333 / 3 = 0.6111

With a miss — ranks [1, 5, none]

  1. RR = 1/1, 1/5, 0 = 1, 0.2, 0 (the no-hit query scores 0)
  2. Σ RR = 1.2, Q = 3 (the miss still counts toward Q)
  3. MRR = 1.2 / 3 = 0.4000

List mode — [0,0,1,0] / [1,0,0] / [0,0,0,0,1]

  1. first 1 at rank 3, 1, 5 ⇒ RR = 1/3, 1, 1/5
  2. Σ RR = 1.5333333, Q = 3
  3. MRR = 1.5333333 / 3 = 0.5111
  4. Same as typing ranks 3, 1, 5 — the modes agree.

Frequently asked questions

Sources & references

The formula on this page was last cross-checked against these sources on 2026-06-10. MRR is a stable mathematical definition, so this tool needs no rate or schedule updates — only the worked examples are periodically re-reconciled.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.