Skip to content

Advertisement
Advertisement unavailable offline
The page content remains available.

Mahalanobis distance calculator

Paste two to four variables and enter the target coordinates. Get D, D² and an indicative p-value.

Distance D: —

Fill in the fields above — the result is computed on this page.

Squared distance D²
—
Indicative p-value
—
Observations
—
Variables
—

Data and target point

For two variables the plot shows observations and the target point.

Target point components

Variable Target Mean Difference
Fill in the fields above — the result is computed on this page.
What do these numbers mean?
  • D = 0 means the point equals the mean vector.
  • A large D indicates an unusual feature combination.
  • The result depends on the covariance matrix estimate.

You need more observations than variables and an invertible covariance matrix. The p-value is model-based, not a universal anomaly threshold.

How do I use this page?
  1. Paste equal-length series for 2–4 variables.
  2. Enter the target point coordinates.
  3. Assess D together with the plot and data assumptions.

What this page does not do: You need more observations than variables and an invertible covariance matrix. The p-value is model-based, not a universal anomaly threshold.

Further reading

Theory — what is Mahalanobis distance?

Mahalanobis distance measures how much a point deviates from a set of variables, taking into account not just the difference from the mean but also the variances and correlations between those variables. As a result, a deviation along a direction where the data naturally spreads out counts for less than an equally sized move along a direction that is rare for that data. The D² value can be translated roughly into a p-value, showing how unusual the point is. Unlike Euclidean distance, this method scales units on its own.

Frequently asked questions

How does it differ from Euclidean distance?
Mahalanobis scales directions by variance and accounts for correlation, so units and dependence do not distort the result.
Why is there no result?
Usually the series differ in length or variables are linearly dependent, making the covariance matrix non-invertible.

See also

← All calculators

Advertisement
Advertisement unavailable offline
The page content remains available.
Offline app and draw notifications

My saved selections

Selections saved only in this browser. Numbers are shown exactly as saved; this is not a lottery ticket.

Open the My saved selections hub
Restore with preview

Restore in the hub: review the file and confirm first. Both old backups and the complete selections + journal backup are supported. Nothing is uploaded.