About ROC Curve and AUC Calculator
This ROC curve and AUC calculator is free, needs no sign-up and runs in your browser, so your scores and labels are never uploaded. Paste one score and one label per line, and the tool draws the ROC curve, computes the area under it with the trapezoid rule, draws the precision-recall curve and reports average precision.
A threshold slider turns the curves into a decision. Drag it and the confusion matrix, precision, recall, false positive rate, F1 and MCC at that threshold update, while a marker moves along the curve. One button jumps to the threshold that maximises Youden's J, the gap between the true positive rate and the false positive rate.
A classifier rarely outputs a hard yes or no; it outputs a score. The ROC curve shows how the true positive rate and false positive rate trade off as the cut-off moves, and the AUC summarises that trade-off in one number that does not depend on any single threshold.
How to use ROC Curve and AUC Calculator
- Paste your data as score,label lines. A label is 1 for the positive class and 0 for the negative class; true and false also work.
- Or tap an example to load a good model, a weak model, an imbalanced set or the classic four-point example.
- Read the AUC and average precision in the result card.
- Switch between the ROC curve and the precision-recall curve.
- Move the threshold slider, or press the best-threshold button, to see the confusion matrix and metrics at that cut-off.
- Open the curve points table to see every threshold, false positive rate, true positive rate and precision.
Features
- ROC curve with the chance diagonal, shaded area and a marker for your chosen threshold.
- AUC by the trapezoid rule, with ties between a positive and a negative counted as half.
- Precision-recall curve with the no-skill baseline, and average precision.
- A threshold slider with the live confusion matrix, accuracy, precision, recall, false positive rate, F1 and MCC.
- The best threshold by Youden's J statistic in one tap.
- Up to 20,000 rows, with a table of the curve points.
- A plain-English reading of what the AUC means for your model.
How the curves and AUC are computed
Sort the cases by score from high to low. Every distinct score is a threshold: cases at or above it are predicted positive. At each threshold compute the true positive rate (TPR, also called recall) and the false positive rate (FPR). Plotting TPR against FPR gives the ROC curve.
The AUC is the area under that curve, found with the trapezoid rule. It equals the probability that a randomly chosen positive case has a higher score than a randomly chosen negative one, with ties counted as half. Average precision is the sum of the precision at each recall step, weighted by the size of the step.
TPR = TP / (TP + FN)
FPR = FP / (FP + TN)
AUC = sum of (FPR_i - FPR_i-1)(TPR_i + TPR_i-1) / 2
AP = sum of (R_n - R_n-1) P_n
Youden J = TPR - FPRWorked examples
scores 0.1, 0.4, 0.35, 0.8 with labels 0, 0, 1, 1 gives AUC 0.75, average precision 0.8333
This is the standard small example from the scikit-learn documentation. Of the four positive-negative pairs, three are ranked correctly, so the AUC is 3 / 4.
The "Good model" sample (20 cases) gives AUC 0.87, best threshold 0.66
Youden's J at that threshold is 0.6.
The "Weak model" sample (20 cases) gives AUC 0.525
Close to the 0.5 of a coin flip: the scores barely separate the two classes.
Rough reading of an AUC value
| AUC | Reading |
|---|---|
| 0.9 to 1.0 | Excellent separation |
| 0.8 to 0.9 | Good |
| 0.7 to 0.8 | Fair |
| 0.5 to 0.7 | Weak |
| 0.5 | No better than chance |
| below 0.5 | Worse than chance: the scores may be reversed |
Good to know
ROC or precision-recall: which to look at
The ROC curve is insensitive to class balance, which is both a strength and a trap. When positives are rare, a classifier can have an impressive AUC while most of its positive predictions are wrong, because the false positive rate is divided by the large number of negatives.
The precision-recall curve shows precision directly, so it exposes that problem. Compare average precision with the base rate of positives (the no-skill line). If positives are rare and you care about the quality of positive predictions, give the precision-recall curve more weight.
A threshold is a decision, not a property of the model
The best threshold by Youden's J treats a missed positive and a false alarm as equally bad. In real work they rarely are. Use the slider to find the cut-off that fits your costs, and report precision and recall at that point, not only the AUC.
Privacy: how it works
- Your scores and labels are processed by code running in your browser tab. They are never sent to Ulkaa or anyone else.
Tips
- Scores need not be probabilities. Any number where higher means more likely positive works, because only the ranking matters.
- The AUC depends only on the order of the scores. Multiplying all scores by a constant changes nothing.
- Tied scores are handled as one step. A tie between a positive and a negative cuts a diagonal and counts half.
- Both classes must appear in the data, or the rates are undefined and the tool asks for more.
Frequently asked questions
Is it really free?
Yes. There is no price, no trial and no credit card. Ulkaa Tool does the work with your own device, so there is no server bill to pass on to you.
Do I need an account?
No. There is no sign-up and no login. Open the page and use it. An Ulkaa account is not needed for anything on this tool.
Does it run in my browser?
Yes. Your scores and labels are processed by code running in your browser tab, on your own device.
Is my data uploaded?
No. Your scores and labels are never sent to Ulkaa or to anyone else. You can check this yourself by watching the Network tab in your browser developer tools while you use the tool.
What is an ROC curve?
A plot of the true positive rate against the false positive rate as the decision threshold moves from high to low. A curve that hugs the top-left corner is a good classifier; the diagonal is chance.
What does AUC mean?
AUC is the area under the ROC curve. It is the probability that a random positive case scores higher than a random negative case. 1 is perfect and 0.5 is chance.
How is AUC calculated?
The tool sorts cases by score, builds the ROC points at each distinct threshold and sums the trapezoids under the curve. Ties count as half.
What format do the labels need?
One line per case: score, then label. Use 1 or 0, or true or false, separated by a comma, tab, semicolon or space. A header line is skipped.
What is average precision?
The area under the precision-recall curve, computed as a sum of precision values weighted by the increase in recall at each threshold. It rewards ranking the positives early.
How do I choose a threshold?
Move the slider and watch the confusion matrix. Youden's J gives a balanced default, but pick the cut-off that matches the cost of false positives and false negatives in your problem.
Why is my AUC below 0.5?
The scores rank negatives above positives. Either the labels are swapped or the model learned the wrong direction. Reversing the scores would give 1 minus the AUC.
Can I use it for more than two classes?
Not directly. ROC curves are for two classes. For several classes, run one class against the rest, one at a time.
Popular ROC Curve and AUC Calculator pages
- ROC Curve CalculatorPaste scores and labels to plot the ROC curve and move along it with a threshold slider.
- AUC CalculatorPaste scores and labels and get the area under the ROC curve.
- Precision-Recall Curve CalculatorSee precision against recall for every threshold, and compare it with the no-skill line.
- Average Precision CalculatorGet the average precision of a ranked list of predictions.
- Optimal Classification Threshold FinderFind the cut-off that best balances true positives and false positives.
- ROC AUC for Imbalanced DataCheck what a ROC AUC means when only a few cases are positive.