Statistics

KL Divergence Calculator

Compare two aligned discrete distributions using Kullback–Leibler divergence.

Data stays on this deviceConvention explained below
Data explorer
Data explorer

Check the dataset and sample convention before interpreting results.

See the method

Add your observations

Runs on your device

Your statistical summary

Your result

Let’s calculate.

Use the Calculate button to see your result.

Review the method below for assumptions and conventions.

How to use this tool

  1. Enter distribution p weights, distribution q weights.
  2. Select Calculate to view the result.
  3. Check the method and assumptions below before using the result.

The method, explained

Normalize each list and compute D(P||Q)=Σp ln(p/q), skipping p=0. Positive p with q=0 yields infinite divergence.

A WORKED EXAMPLE

Using distribution p weights = 1, 1, distribution q weights = 1, 3, the result is 0.143841036. Change these example inputs to match your task; use the method above to check each step.

What to keep in mind

Aligned category order is essential. KL divergence is asymmetric and is not a distance metric. A descriptive or probability calculation under the stated assumptions. Check the sample design and model before interpreting results.

Common questions

Which inputs does this calculation need?

Compare two aligned discrete distributions using Kullback–Leibler divergence. Enter distribution p weights, distribution q weights. The filled example is editable and is not a saved personal record.

How should I interpret the result?

Aligned category order is essential. KL divergence is asymmetric and is not a distance metric. A descriptive or probability calculation under the stated assumptions. Check the sample design and model before interpreting results.

Methodology maintained by ClarityKit. How these tools are built and checked.