Precision@K and Recall@K Calculator
Score the top-K results of a retriever, search ranker or RAG pipeline in seconds. Paste a ranked 0/1 relevance list — or type the counts — and get Precision@K, Recall@K, F1@K and Hit Rate@K with a per-K breakdown. No signup, no ads.
How it works
Precision@K and Recall@K evaluate the top K results a ranked system returns for a single query — a search engine, a recommender, or the retriever inside a RAG pipeline. Both start from the same count: how many of the top K results are actually relevant. Call that hits@K. These are the standard information-retrieval definitions from Manning, Raghavan & Schütze, Introduction to Information Retrieval (Chapter 8).
Precision@K asks how clean the top K is:Precision@K = hits@K / KOf the K results you showed, what fraction were right? It penalises padding the list with noise. Precision@K tends to fall as K grows, because you are forced to include lower-ranked, less certain results.
Recall@K asks how much of the relevant set you captured:Recall@K = hits@K / Rwhere R is the total number of relevant items that exist for the query. Recall@K rises (never falls) as K grows, because a deeper cutoff can only find more of the relevant set. If R = 0the ratio divides by zero, so recall is undefined and this tool reports N/A instead of a misleading 0.
F1@K combines the two into one number using the harmonic mean:F1@K = 2 · P · R / (P + R)The harmonic mean sits close to the smaller of the two, so a system cannot earn a high F1@K by being precise but incomplete, or thorough but noisy. There is an equivalent count form, F1@K = 2·hits / (K + R), that gives the same answer without ever forming precision or recall — this calculator computes F1@K both ways and cross-checks them, which is what the “Formulas verified” badge means.
Hit Rate@K is the simplest signal:Hit Rate@K = 1 if hits@K ≥ 1 else 0It answers “did we retrieve anycorrect result in the top K?” — the check RAG developers care about most, since one good chunk is often enough for the language model to answer. In ranked-list mode the tool recomputes all three ratio metrics at every cutoff from K = 1 to the list length, so you can watch the precision–recall trade-off and choose the top-K depth that fits your task.
Worked examples
Frequently asked questions
Sources & references
- Manning, Raghavan & Schütze — Introduction to Information Retrieval, Ch. 8 (precision, recall, precision/recall at K)
- scikit-learn — Ranking metrics (top-K precision and recall)
- Wikipedia — Evaluation measures (information retrieval): precision@k, recall@k, F-measure
The definitions on this page were last cross-checked against the IR-book and scikit-learn on 2026-07-06. These are standard mathematical definitions that do not change over time; F1@K is verified by computing it two independent ways and confirming they agree.
Related tools
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.