%3C/text%3E%3C/svg%3E">
💻
💻 Tech & IT

Log Loss (Cross-Entropy) Calculator

Results update as you type.

Your numbers

Understanding the log loss (cross-entropy) calculator — concept and principle

Log loss, also called binary cross-entropy, scores probabilistic predictions: it rewards a model for giving high probability to what actually happened and punishes confident mistakes very hard. It is the loss most classifiers minimise during training and a standard evaluation metric in forecasting and data-science competitions. This calculator also returns the Brier score, a gentler squared-error measure of the same predictions.

Per-sample log loss for four predictionsThe model gives 0.9, 0.8, 0.7 and 0.6 to the true class, costing 0.105, 0.223, 0.357 and 0.511. Their mean is the log loss 0.299.Penalty = −ln(probability given to the truth)p = 0.9truth = 10.9 on truth0.105p = 0.2truth = 00.8 on truth0.223p = 0.7truth = 10.7 on truth0.357p = 0.4truth = 00.6 on truth0.511Mean: 1.196 ÷ 4 = 0.299Confident & wrong (0.01 on truth) → 4.6
The less probability on the true answer, the bigger the penalty; the mean is 0.299.

How it is calculated

Here pᵢ is the predicted probability that sample i belongs to class 1 and yᵢ is its true label (1 or 0). For a label of 1 only −ln p counts; for a label of 0 only −ln(1 − p). Probabilities are clipped to the range 10⁻¹⁵ to 1 − 10⁻¹⁵ so that a prediction of exactly 0 or 1 does not produce an infinite loss.

The principle

Log loss is the negative average log-likelihood of the observed labels under the model. Minimising it is the same as maximum-likelihood estimation, and in information-theory terms it measures how many nats of surprise the outcomes caused. It is a strictly proper scoring rule: you get the best expected score only by reporting your true belief, so honest, calibrated probabilities are rewarded. The logarithm makes the penalty explode as the probability given to the true outcome approaches zero.

Worked example

  1. Pairs (p, y): (0.9, 1), (0.2, 0), (0.7, 1), (0.4, 0).
  2. Per-sample losses: −ln 0.9 = 0.1054; −ln 0.8 = 0.2231; −ln 0.7 = 0.3567; −ln 0.6 = 0.5108.
  3. Mean = 1.1960 ÷ 4 = 0.2990.
  4. Brier: (0.1² + 0.2² + 0.3² + 0.4²) ÷ 4 = 0.30 ÷ 4 = 0.075.

How to read the result

Lower is better and 0 is perfect. A useful reference is the loss of always predicting 0.5: ln 2 ≈ 0.693 for log loss and 0.25 for Brier. A model above those values is worse than a coin flip. With imbalanced classes, compare against always predicting the base rate instead. A single prediction of 0.01 for an event that happens costs about 4.6, which can dominate the average.

Common mistakes

Keep in mind: A low log loss on one dataset does not guarantee good calibration elsewhere. Check results on fresh data, and remember that log loss is very sensitive to a few overconfident errors.

Frequently asked questions

What is the difference between log loss and cross-entropy?

For binary labels they are the same quantity; cross-entropy is the general name for any number of classes.

Should I use log loss or Brier score?

Log loss punishes confident errors more strongly; Brier is bounded between 0 and 1 and easier to explain. Many teams report both.

Can log loss be greater than 1?

Yes. It has no upper limit, and confident wrong predictions easily push it above 1.

Sources: G. W. Brier, Verification of forecasts expressed in terms of probability, Monthly Weather Review, 1950 · T. Gneiting and A. E. Raftery, Strictly proper scoring rules, prediction, and estimation, Journal of the American Statistical Association, 2007

Checked 8 Nov 2026. Standard formulas and RFC/IEEE definitions, computed locally in your browser — nothing you type is sent anywhere.

💻 All tech & IT tools →🌍 Calculators by country →