Log Loss Calculator

Binary logarithmic loss from labels and probabilities.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Enter the true 0/1 labels and your model's predicted probabilities for class 1, and get the binary log loss. It punishes confident wrong predictions heavily. Lower is better; 0 is perfect.

How to use

1
Step 1
Enter the labels (0 or 1), comma separated.
2
Step 2
Enter the predicted probabilities in the same order.
3
Step 3
Press Calculate.

How it works

Log loss = −(1/n) Σ [y·ln(p) + (1 − y)·ln(1 − p)] with natural logs. A correct prediction at p = 0.9 costs 0.105; a wrong one at p = 0.9 costs 2.30. Predicting 0.5 for everything gives 0.693.

−(1/n) Σ [ y·ln p + (1 − y)·ln(1 − p) ]

Worked example

Four predictions

Input
Labels: 1, 0, 1, 1 Probabilities: 0.9, 0.1, 0.8, 0.7
Output
Log loss 0.197635 (n = 4)
Walkthrough
The per-example losses are −ln 0.9 = 0.105, −ln 0.9 = 0.105, −ln 0.8 = 0.223 and −ln 0.7 = 0.357. Their average is 0.1976.

Limitations

  • Binary labels only; for several classes use cross-entropy.
  • Probabilities are clipped away from exactly 0 and 1, so a fully confident wrong prediction costs about 34.5 instead of infinity, and one of those can dominate the average.
  • Uses natural logarithms (nats).

Questions

How do I calculate log loss?
Enter the true labels and predicted probabilities. The tool averages the negative log-likelihood.
What is a good log loss?
Lower is better. A model that always predicts 0.5 scores 0.693, so you want to beat that.
Log loss vs accuracy?
Accuracy only checks the predicted class; log loss also judges how confident the probabilities are.
Is log loss the same as cross-entropy?
Binary log loss is binary cross-entropy.

Features

  • Binary cross-entropy
  • Natural log
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Machine Learning for Everybody

    freeCodeCamp.org

    Accessible ML survey for AI calculator and metric tools.

    Watch on YouTube
  • Vectors | Essence of linear algebra

    3Blue1Brown

    Embeddings and vectors start with linear algebra intuition.

    Watch on YouTube