Distance Between Two Points Calculator
Enter the coordinates of two points to get the straight-line distance between them using the distance formula, along with the midpoint and the slope of the line joining them.
How to find the distance between two points
- Enter the coordinates of the first point as x1 and y1.
- Enter the coordinates of the second point as x2 and y2.
- Read the distance, midpoint and slope that update live.
Examples
A 3-4-5 right triangle
(0, 0) and (3, 4)
Distance 5, midpoint (1.5, 2), slope 1.333
A vertical line
(2, 1) and (2, 7)
Distance 6, slope undefined
Frequently asked questions
What is the distance formula?
For points (x1, y1) and (x2, y2), the distance is the square root of (x2 - x1) squared plus (y2 - y1) squared. It comes straight from the Pythagorean theorem, treating the horizontal and vertical gaps as the two legs of a right triangle.
How do I find the midpoint?
Average the coordinates: the midpoint is ((x1 + x2) / 2, (y1 + y2) / 2). It sits exactly halfway along the segment, so it is the same distance from each endpoint.
Why is the slope sometimes undefined?
The slope is the rise over the run, (y2 - y1) / (x2 - x1). When both points share the same x value the run is zero, which would mean dividing by zero, so the line is vertical and its slope is undefined rather than a number.
Can I measure distance in 3D?
Yes. The same idea extends to three dimensions by adding the squared difference in z under the square root. This tool focuses on 2D points but the underlying formula handles 3D coordinates the same way.
Does it work with negative or decimal coordinates?
Yes. Negative coordinates and decimals are fully supported, and the distance is always reported as a non-negative value because it squares the differences before taking the square root.
Related tools
Slope Calculator
Find the slope, y-intercept, line equation, distance, midpoint and angle from two points. Enter two coordinates and read every value instantly.
Pythagorean Theorem Calculator
Find the missing side of a right triangle with a squared plus b squared equals c squared. Get the legs, hypotenuse, area and perimeter instantly.
Vector Calculator
Add, subtract, scale, and find the dot and cross product of 2D and 3D vectors. Get magnitude, unit vector, angle, distance, and projection instantly.
Area Calculator
Find the area of a circle, square, rectangle, triangle, trapezoid, parallelogram, ellipse, sector or rhombus. Free and runs in your browser.
Arithmetic Sequence Calculator
Find the nth term, the sum of n terms and the full term list for any arithmetic or geometric sequence. Enter the first term, step or ratio, and n.
Average Calculator
Find the mean, median, mode, range, sum, count, min and max of a list of numbers. Paste values separated by commas, spaces or new lines.