Hellinger Distance Calculator
Measure how far apart two probability distributions are. Paste two discrete vectors, or enter two Gaussians, and read the Hellinger distance (bounded 0 to 1), the Bhattacharyya coefficient and the Bhattacharyya distance — with full per-term working, all in your browser, no signup.
How it works
The Hellinger distance and the two Bhattacharyya quantities all measure the overlap between two probability distributions defined over the same set of outcomes. Everything is built from one number, the Bhattacharyya coefficient, introduced by A. Bhattacharyya in 1943:
BC(P, Q) = Σᵢ √(pᵢ · qᵢ)
BC lies in [0, 1]: it is 1 when P and Q are identical and 0 when they are disjoint. From it the two distances follow directly, using the standard discrete definitions catalogued by Cha (2007):
- Bhattacharyya distance D_B = −ln(BC), in [0, ∞). It is 0 for identical distributions and +∞ when the overlap is zero. D_B is symmetric but is not a metric — it fails the triangle inequality.
- Hellinger distance H = √(1 − BC), in [0, 1]. Unlike KL divergence it is a true metric: symmetric, bounded, and it obeys the triangle inequality, which is why it is a safe drop-in “distance” for clustering and nearest-neighbour work.
- The identity H² = 1 − BC means the affinity 1 − H² recovers BC exactly, so the three outputs are three views of the same overlap.
There is an equivalent second form of the Hellinger distance, H = (1/√2)·√( Σᵢ (√pᵢ − √qᵢ)² ). It is algebraically identical because Σ(√pᵢ−√qᵢ)² = Σpᵢ + Σqᵢ − 2Σ√(pᵢqᵢ) = 2(1 − BC). The calculator computes H both ways and shows them reconciling — a built-in correctness check. Before scoring, each vector is normalised to sum to 1 (the SciPy / scikit-learn convention), so you can paste raw counts or histograms directly.
For two univariate Gaussians the tool uses the closed form. With variances σ₁², σ₂² and means μ₁, μ₂: D_B = ¼·ln(¼·(σ₁²/σ₂² + σ₂²/σ₁² + 2)) + ¼·((μ₁−μ₂)²/(σ₁²+σ₂²)), then BC = exp(−D_B) and H = √(1 − BC). This is cross-checked against the closed-form Gaussian coefficient √(2σ₁σ₂/(σ₁²+σ₂²))·exp(−¼·(μ₁−μ₂)²/(σ₁²+σ₂²)), which is algebraically equal to exp(−D_B).
Worked examples
Frequently asked questions
Sources & references
- Cha, S. (2007), “Comprehensive Survey on Distance/Similarity Measures between Probability Density Functions”, Int. J. Math. Models & Methods 1(4):300–307
- Wikipedia — Bhattacharyya distance (discrete formulas and the Gaussian closed form)
- Wikipedia — Hellinger distance (metric properties, relation to the Bhattacharyya coefficient)
- SciPy — auto-normalisation convention used for probability vectors
The formulas on this page originate with Bhattacharyya (1943) and Hellinger (1909); they are mathematically fixed and were last cross-checked against Cha (2007) and the Wikipedia references on 2026-07-16. Every worked example reproduces to the displayed precision.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.