{"id":66995,"date":"2026-10-13T11:11:02","date_gmt":"2026-10-13T08:11:02","guid":{"rendered":"https:\/\/wpcalc.com\/en\/?p=66995"},"modified":"2026-10-13T11:11:02","modified_gmt":"2026-10-13T08:11:02","slug":"roc-auc-calculator","status":"publish","type":"post","link":"https:\/\/wpcalc.com\/en\/statistics\/roc-auc-calculator\/","title":{"rendered":"ROC AUC Calculator"},"content":{"rendered":"<section class=\"not-prose calculator-box\" aria-labelledby=\"calculator-title\"><div class=\"flex items-baseline sm:items-center justify-between gap-2 sm:gap-3\"><div class=\"flex flex-col sm:flex-row sm:items-center gap-2\"><span class=\"icon icon-calculator text-primary-700! text-base! dark:text-primary-300!\" aria-hidden=\"true\"><\/span><h2 id=\"calculator-title\" class=\"text-lg font-display font-bold\">Measure How Well Your Scores Separate Two Classes<\/h2><\/div><div class=\"calcdash-favorite group\">\n  <button type=\"button\" class=\"favorite\" id=\"favorite\" data-favorite-id=\"66995\" data-favorite-title=\"ROC AUC\" data-favorite-url=\"https:\/\/wpcalc.com\/en\/statistics\/roc-auc-calculator\/\" data-favorite-excerpt=\"Enter class labels (0\/1) and prediction scores to compute the ROC AUC, Gini coefficient, best cutoff by Youden&#039;s J, confusion matrix, and the full ROC curve points.\" aria-label=\"Add to Favorites\" data-favorite-icon=\"icon icon-wpcalc-dice\">\n    <span class=\"icon icon-shape-star-empty\" aria-hidden=\"true\"><\/span>\n  <\/button>\n  <div class=\"calcdash-favorite__tip\" aria-hidden=\"true\">\n   <span class=\"favorite-tooltip\" id=\"favorite-tooltip\"><\/span>\n  <\/div>\n  <span class=\"sr-only\" role=\"status\" id=\"favorite-status\"><\/span>\n<\/div><\/div><form action=\"https:\/\/wpcalc.com\/en\/statistics\/roc-auc-calculator\/\" method=\"POST\" class=\"calculator\" id=\"calculator-66995\" data-post=\"66995\"><fieldset class=\"fieldset-input is-1\"><legend class=\"sr-only\">Input Fields<\/legend><div class=\"field\" id=\"input-1\"><label for=\"field-1\">Actual class labels (0 or 1)<\/label><textarea id=\"field-1\" name=\"actual_class_labels_0_or_1\">1; 1; 0; 1; 0; 0; 1; 0; 1; 0<\/textarea><\/div><div class=\"field\" id=\"input-2\"><label for=\"field-2\">Prediction scores<\/label><textarea id=\"field-2\" name=\"prediction_scores\">0.9; 0.8; 0.7; 0.85; 0.3; 0.2; 0.6; 0.4; 0.75; 0.1<\/textarea><\/div><div class=\"field has-term\" id=\"input-3\"><label for=\"field-3\">Threshold for the confusion matrix<\/label><div class=\"term\">t<\/div>  <div class=\"absolute bottom-0 left-16 top-8 w-2 h-0.5 bg-blue-500\"><\/div><input type=\"number\" name=\"threshold_for_the_confusion_matrix\" id=\"field-3\" aria-describedby=\"calc-info-3\" placeholder=\"e.g. 0.5\" step=\"any\" value=\"0.5\"\/><small id=\"calc-info-3\">A case is predicted positive when its score is greater than or equal to this cutoff. Does not affect the AUC.<\/small><\/div><\/fieldset><div class=\"buttons\"><button type=\"submit\" data-text=\"Re-Calculate\" id=\"calculate-button\" data-post=\"66995\">Calculate<\/button><button type=\"reset\">Reset<\/button><\/div><div class=\"field is-checkbox hidden!\" id=\"field-auto-calc\"><input type=\"checkbox\" id=\"auto-calc\"><label for=\"auto-calc\">Calculate automatically<\/label><small>If enabled, the result will update automatically when you change any value.<\/small><\/div><div class=\"fieldset-result is-hidden\" aria-labelledby=\"result-title\" aria-live=\"polite\" role=\"region\"> <h3 class=\"result-title bg-gradient-to-r from-primary-50 to-gray-50 dark:from-primary-900 dark:to-gray-800\" id=\"result-title\"><span class=\"icon icon-s-pulse\" aria-hidden=\"true\"><\/span> ROC Analysis Results<\/h3><div class=\"result-box\"><div class=\"field-result\" id=\"output-1\"><span class=\"field-title\"><span>Area under the ROC curve<\/span><span class=\"result-term\">AUC<\/span><\/span><span class=\"field-value\" id=\"result-1\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><div class=\"field-result\" id=\"output-2\"><span class=\"field-title\"><span>Gini coefficient (2\u00b7AUC \u2212 1)<\/span><span class=\"result-term\">G<\/span><\/span><span class=\"field-value\" id=\"result-2\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><div class=\"field-result\" id=\"output-3\"><span class=\"field-title\"><span>Best cutoff (Youden&#039;s J)<\/span><\/span><span class=\"field-value\" id=\"result-3\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><div class=\"field-result is-column\" id=\"output-4\"><span class=\"field-title\"><span>Confusion matrix at the chosen threshold<\/span><\/span><span class=\"field-value\" id=\"result-4\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><div class=\"field-result is-column\" id=\"output-5\"><span class=\"field-title\"><span>ROC curve points<\/span><\/span><span class=\"field-value\" id=\"result-5\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><div class=\"field-result is-column\" id=\"output-6\"><span class=\"field-title\"><span>How to read the results<\/span><\/span><span class=\"field-value\" id=\"result-6\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><\/div><div class=\"result-actions\"><button type=\"button\" class=\"copy-link\"><svg viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M12.232 4.232a2.5 2.5 0 0 1 3.536 3.536l-1.225 1.224a.75.75 0 0 0 1.061 1.06l1.224-1.224a4 4 0 0 0-5.656-5.656l-3 3a4 4 0 0 0 .225 5.865.75.75 0 0 0 .977-1.138 2.5 2.5 0 0 1-.142-3.667l3-3Z\"\/><path d=\"M11.603 7.963a.75.75 0 0 0-.977 1.138 2.5 2.5 0 0 1 .142 3.667l-3 3a2.5 2.5 0 0 1-3.536-3.536l1.225-1.224a.75.75 0 0 0-1.061-1.06l-1.224 1.224a4 4 0 1 0 5.656 5.656l3-3a4 4 0 0 0-.225-5.865Z\"\/><\/svg><span class=\"copy-link__text\">Copy link to this calculation<\/span><\/button><span class=\"sr-only\" role=\"status\" id=\"copy-link-status\"><\/span><\/div><\/div><a href=\"#respond\" class=\"hidden transition-opacity duration-300 opacity-0 w-50 text-sm justify-center items-center gap-2 px-4 py-2 rounded bg-gray-200 text-gray-700 hover:bg-gray-300\" id=\"leave-comment\"><span class=\"icon icon-comments\" aria-hidden=\"true\"><\/span>Leave a Comment<\/a><\/form><\/section><section id=\"calc-reactions\" class=\"not-prose hidden my-12 bg-gradient-to-r from-primary-50 to-gray-50 border border-indigo-100 rounded-xl px-6 py-4 shadow-sm\" data-post=\"66995\" aria-live=\"polite\" aria-labelledby=\"calc-reactions-title\"><p id=\"calc-reactions-title\" class=\"text-sm text-gray-500 text-center mb-2\">How did this result make you feel?<\/p><div role=\"group\" aria-labelledby=\"calc-reactions-title\" class=\"grid grid-cols-3 sm:flex sm:flex-row sm:justify-around gap-4 sm:items-center sm:flex-wrap\"><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"like\"><span class=\"reaction-count\" data-reaction-count=\"like\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude00 <\/span><span class=\"reaction-description font-medium\">Like <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"helpful\"><span class=\"reaction-count\" data-reaction-count=\"helpful\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\udca1 <\/span><span class=\"reaction-description font-medium\">Helpful <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"confused\"><span class=\"reaction-count\" data-reaction-count=\"confused\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude15 <\/span><span class=\"reaction-description font-medium\">Confused <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"disappointed\"><span class=\"reaction-count\" data-reaction-count=\"disappointed\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude1e <\/span><span class=\"reaction-description font-medium\">Disappointed <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"inaccurate\"><span class=\"reaction-count\" data-reaction-count=\"inaccurate\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\u274c <\/span><span class=\"reaction-description font-medium\">Inaccurate <\/span><\/button><\/div><div id=\"reaction-message\" class=\"hidden mt-8 rounded-md border border-primary-100 bg-white\/50 backdrop-blur-sm px-4 py-2 text-sm text-center shadow-sm\"><\/div><\/section><div class=\"calcdash-ad not-prose calcdash-ad--calc_result calcdash-ad--in-article\"><ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-1721569815777345\" data-ad-slot=\"6317458308\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\"><\/ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script><\/div>\n<style id=\"wpcoderpro-inline-1\">.formula-box {\r\n\tborder-bottom: none !important;\r\n}<\/style><section class=\"formula-box\" aria-labelledby=\"formula-title\">\r\n\t<div id=\"formula-title\" class=\"not-prose font-display mb-4\"><span class=\"icon icon-formula\" aria-hidden=\"true\"><\/span><h2>ROC AUC Formula<\/h2><\/div>\r\n\t<figure class=\"not-prose formula\">\r\n\t\t<figcaption class=\"formula-title\">Formula<\/figcaption>\r\n\t\t<div class=\"text-base text-gray-800\" id=\"formula\">\n\\[ \\text{AUC} = \\frac{\\#\\{\\text{pairs with } s_+ &gt; s_-\\} + \\tfrac{1}{2}\\,\\#\\{\\text{pairs with } s_+ = s_-\\}}{P \\cdot N} \\]\n\\[ G = 2\\,\\text{AUC} - 1, \\qquad J = \\text{sensitivity} + \\text{specificity} - 1 = \\text{TPR} - \\text{FPR} \\]\n<\/div>\r\n\t<\/figure>\r\n\t<\/p>\n<p><strong>Where:<\/strong><\/p>\n<ul>\n<li>\\(P\\) \u2014 number of positive cases (label 1)<\/li>\n<li>\\(N\\) \u2014 number of negative cases (label 0)<\/li>\n<li>\\(s_+\\) \u2014 score of a positive case; \\(s_-\\) \u2014 score of a negative case<\/li>\n<li>\\(G\\) \u2014 Gini coefficient (Somers' D), a rescaling of the AUC<\/li>\n<li>\\(J\\) \u2014 Youden's J statistic, used to find the best cutoff<\/li>\n<\/ul>\n<p>The AUC is the probability that a randomly drawn positive case receives a higher score than a randomly drawn negative case (ties count as half a win). It equals the trapezoidal area under the ROC curve and the Mann\u2013Whitney U statistic divided by \\(P \\cdot N\\).<\/p>\n<p>\r\n<\/section>\n<style id=\"wpcoderpro-inline-459\">.calculation-box {\r\n\tborder-bottom: none !important;\r\n}<\/style><section id=\"calculation\" class=\"calculation-box\" aria-labelledby=\"calculation-title\">\r\n\t<div id=\"calculation-title\" class=\"not-prose font-display\"><span class=\"icon icon-unordered-list\" aria-hidden=\"true\"><\/span><h2>ROC AUC \u2013 Calculation Example<\/h2><\/div>\r\n\r\n<\/p>\n<p><strong>Example:<\/strong> 10 cases, 5 positive and 5 negative, with the default scores. The positive scores are 0.9, 0.85, 0.8, 0.75, 0.6 and the negative scores are 0.7, 0.4, 0.3, 0.2, 0.1.<\/p>\n<p>There are \\(P \\cdot N = 25\\) positive\u2013negative pairs. In 24 of them the positive case scores higher; the only mis-ranked pair is (0.6, 0.7). No pairs are tied, so:<\/p>\n<p>\\[ \\text{AUC} = \\frac{24 + \\tfrac{1}{2}\\cdot 0}{5 \\times 5} = 0.96 \\]<\/p>\n<p><strong>Result:<\/strong> AUC = 0.96, Gini coefficient \\(2 \\times 0.96 - 1 = 0.92\\). The best cutoff by Youden's J is <strong>score \u2265 0.6<\/strong> (sensitivity 100%, specificity 80%, \\(J = 0.8\\)). At the default threshold 0.5 the confusion matrix is TP = 5, FP = 1, FN = 0, TN = 4 (accuracy 90%).<\/p>\n<p>\n\r\n<\/section>\n<h2>How to use the calculator<\/h2>\n<ol>\n<li>Paste your <strong>Actual class labels (0 or 1)<\/strong> into the first field \u2014 one label per case, separated by spaces, new lines or semicolons. Use 1 for the positive class and 0 for the negative class.<\/li>\n<li>Paste your <strong>Prediction scores<\/strong> into the second field, in the same order as the labels. Any numeric scale works (probabilities, model outputs, ratings); decimal commas are accepted.<\/li>\n<li>Optionally change the <strong>Threshold for the confusion matrix<\/strong> (default 0.5). A case is predicted positive when its score is \u2265 this cutoff. The threshold does not affect the AUC.<\/li>\n<li>Read the results: the <strong>Area under the ROC curve<\/strong>, the <strong>Gini coefficient<\/strong>, the <strong>best cutoff (Youden's J)<\/strong>, the confusion matrix at your threshold, and a table of ROC curve points you can plot.<\/li>\n<\/ol>\n<p>The two lists must have the same length, and the data must contain at least one positive and one negative case \u2014 otherwise no ranking can be evaluated.<\/p>\n<h2>What is the ROC AUC?<\/h2>\n<p>The ROC curve (Receiver Operating Characteristic) shows how a binary classifier performs at every possible cutoff. Each point on the curve is a (false-positive rate, true-positive rate) pair obtained by classifying all cases with score \u2265 some cutoff as positive. Sweeping the cutoff from high to low traces the curve from the origin (nothing predicted positive) to the top-right corner (everything predicted positive).<\/p>\n<p>The AUC \u2014 the area under that curve \u2014 summarises the whole curve in one number. It has a direct probabilistic meaning: the chance that a randomly chosen positive case scores above a randomly chosen negative case. A perfect ranking gives AUC = 1; a useless (random) ranking gives AUC = 0.5; a consistently inverted ranking gives AUC &lt; 0.5, which means you should reverse the direction of your scores.<\/p>\n<p>A useful rough guide: 0.9\u20131 excellent, 0.8\u20130.9 good, 0.7\u20130.8 fair, 0.6\u20130.7 poor, 0.5 no better than chance. The Gini coefficient \\(2\\cdot\\text{AUC}-1\\) rescales this so that 0 means chance and 1 means perfect; it is common in credit scoring, where it is also called Somers' D.<\/p>\n<p>Unlike accuracy or precision, the AUC is <em>threshold-free<\/em>: it measures how well the scores <em>rank<\/em> cases, independent of any cutoff you might later choose. That makes it the natural metric for comparing scoring models, but it also means it says nothing about calibration \u2014 a score of 0.8 need not correspond to an 80% probability. If you need confusion-matrix metrics at a specific cutoff, pair this tool with the <a href=\"https:\/\/wpcalc.com\/en\/statistics\/confusion-matrix-calculator\/\">Confusion Matrix calculator<\/a>.<\/p>\n<h2>Choosing a cutoff<\/h2>\n<p>The calculator reports the cutoff that maximises Youden's J statistic, \\(J = \\text{sensitivity} + \\text{specificity} - 1\\) \u2014 the point on the ROC curve farthest from the diagonal. It is a sensible default, but not always the operationally best choice. In medical screening you may want high sensitivity and accept more false positives; in a confirmatory test or fraud flagging with costly investigations, specificity may matter more. Use the ROC points table to see the sensitivity\/specificity trade-off at every distinct score and pick the cutoff that fits your costs.<\/p>\n<p>Because the AUC is a ranking measure, it is closely related to other rank statistics. If you are analysing rank agreement more generally, the <a href=\"https:\/\/wpcalc.com\/en\/statistics\/kendalls-tau-calculator\/\">Kendall's Tau calculator<\/a> covers concordant versus discordant pairs between two variables.<\/p>\n<h2>Assumptions, limitations and tips<\/h2>\n<ul>\n<li><strong>Binary outcomes only.<\/strong> Labels must be exactly 0 or 1. For multi-class problems compute one AUC per class (one-versus-rest).<\/li>\n<li><strong>Independence.<\/strong> Each case contributes one label and one score, and cases are assumed independent. Repeated measurements of the same subject violate this.<\/li>\n<li><strong>Ties are handled<\/strong> by counting each tied positive\u2013negative pair as half a success, which matches the trapezoidal AUC and the Mann\u2013Whitney U convention.<\/li>\n<li><strong>Small samples.<\/strong> With few cases the AUC has a wide confidence interval; a Hanley\u2013McNeil or DeLong interval is worth reporting alongside it. The default 10-case example is for illustration only.<\/li>\n<li><strong>Class imbalance.<\/strong> The AUC is insensitive to the positive\/negative mix, which can be an advantage or a blind spot \u2014 a model can have a high AUC while missing many actual positives. Check the confusion matrix and metrics such as the <a href=\"https:\/\/wpcalc.com\/en\/statistics\/odds-ratio-and-relative-risk-calculator\/\">odds ratio<\/a> to see the practical impact.<\/li>\n<li><strong>AUC &lt; 0.5<\/strong> means your scores are inverted: either use \"score \u2264 cutoff\" logic or swap the labels.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Enter class labels (0\/1) and prediction scores to compute the ROC AUC, Gini coefficient, best cutoff by Youden's J, confusion matrix, and the full ROC curve points.<\/p>\n","protected":false},"author":3168,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[74],"tags":[76],"class_list":["post-66995","post","type-post","status-publish","format-standard","hentry","category-statistics","tag-probability"],"acf":[],"_links":{"self":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/66995","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/users\/3168"}],"replies":[{"embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/comments?post=66995"}],"version-history":[{"count":1,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/66995\/revisions"}],"predecessor-version":[{"id":66996,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/66995\/revisions\/66996"}],"wp:attachment":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/media?parent=66995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/categories?post=66995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/tags?post=66995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}