Model evaluation
Cross-entropy loss calculator
Enter the probability assigned to the correct class for each example. The calculator returns mean cross-entropy in nats, the equivalent bits, and perplexity.
Free · no sign-in · updates instantly
1. Enter correct-class probabilities
Each value must be greater than 0 and no greater than 1
Try an example:
Results update as you type.
Mean loss0
Natural-log nats
Loss in bits0 bits
Mean loss ÷ ln(2)
Perplexity0
e raised to mean loss
Formula
mean cross-entropy = (−1/N) × Σ ln(correct-class probability)
perplexity = e^(mean cross-entropy)
The calculator expects probabilities, not logits. It rejects zero because −ln(0) is infinite. For model training, use a numerically stable framework loss that accepts logits when available.
Read the full explanation
See cross-entropy loss and perplexity explained for the worked arithmetic, units, logits, masking, and comparison mistakes.