Calculators
Coordinate Geometry Calculator
Find distance, midpoint, slope, and line equation from two points.
Enter two Cartesian points to find their straight-line distance, midpoint, slope, coordinate changes, and the line through them when a unique line can be expressed.
Results
- Distance
- 5
- Midpoint
- (2.5, 4)
- Slope
- 1.333333333
- Change (Δx, Δy)
- (3, 4)
Line: y = 1.333333333x + 0.6666666667
Coordinates are treated as values on a flat Cartesian plane. Distance therefore uses the same coordinate unit; this is not a latitude/longitude or map-distance calculator.
About This Tool
Two points on a Cartesian plane contain several useful pieces of geometric information. From coordinates (x₁, y₁) and (x₂, y₂), you can calculate the straight-line distance, the point exactly halfway between them, the slope or rate of change, and usually an equation for the line that passes through both points. This calculator brings those related operations together while also handling vertical lines and identical points explicitly instead of forcing an invalid division by zero.
How To Use It
- Enter the x and y coordinates of the first point.
- Enter the x and y coordinates of the second point. Negative values, zero, and decimals are supported.
- Read the distance, midpoint, slope, Δx and Δy, and line equation in the results.
- For a vertical line, interpret the slope as undefined and use the displayed x = constant equation. Identical points do not define one unique line.
Examples
Classic 3-4-5 displacement
For (1, 2) and (4, 6), Δx = 3 and Δy = 4, so distance is 5. The midpoint is (2.5, 4), and slope is 4/3.
Vertical line
Points (3, -2) and (3, 8) have the same x-coordinate. Their distance is 10, midpoint is (3, 3), slope is undefined, and the line equation is x = 3.
Negative and decimal coordinates
For (-2.5, 1.25) and (1.5, -1.75), Δx = 4 and Δy = -3. Distance is 5, midpoint is (-0.5, -0.25), and slope is -0.75.
Useful Notes
Distance between two points
The distance formula is d = √((x₂ - x₁)² + (y₂ - y₁)²). It is the Pythagorean theorem applied to the horizontal and vertical coordinate changes. Distance is always non-negative.
Midpoint formula
The midpoint averages the corresponding coordinates: M = ((x₁ + x₂)/2, (y₁ + y₂)/2). It lies halfway along the straight segment joining the two points.
Slope from two points
Slope is m = (y₂ - y₁)/(x₂ - x₁) = Δy/Δx. Positive slope rises as x increases, negative slope falls, and zero slope is horizontal. If Δx is zero, the line is vertical and slope is undefined.
Equation of the line
For a non-vertical line, the calculator converts the two-point result to slope-intercept form y = mx + b, where b = y₁ - mx₁. A vertical line cannot use slope-intercept form and is written x = constant instead.
Identical points are a special case
If both points are identical, distance is zero and the midpoint is that same point, but infinitely many lines pass through one point. Therefore a unique slope or line equation cannot be inferred from identical points alone.
Cartesian coordinates versus map coordinates
These formulas assume a flat Cartesian coordinate system with compatible x and y units. Latitude and longitude lie on Earth and require geographic distance methods, so raw geographic coordinates should not be entered here when real-world map distance is required.
FAQ
What is the distance formula?
For (x₁, y₁) and (x₂, y₂), distance is √((x₂ - x₁)² + (y₂ - y₁)²).
How do I find the midpoint?
Average the x-coordinates and average the y-coordinates: ((x₁ + x₂)/2, (y₁ + y₂)/2).
Why can slope be undefined?
A vertical line has x₂ - x₁ = 0, so the slope formula would divide by zero. Its equation is x = constant instead.
What happens if both points are the same?
Distance is zero and the midpoint is the same point, but one point alone does not determine a unique line, so slope and a unique line equation are not available.
Can I use negative or decimal coordinates?
Yes. Any finite real coordinate values are supported, including negatives, zero, and decimals.
Related Tools
Linear Equation Solver
Solve one-variable linear equations and two-variable systems.
Triangle Calculator
Solve triangle sides, angles, area, and perimeter.
Circle Calculator
Solve radius, diameter, circumference, and area from one circle measurement.
Scientific Calculator
Scientific math functions with degree and radian modes.