Distance, Midpoint & Slope

Compare Calculations

Downloads

Includes your inputs and results for this calculation, plus any additional calculations you've compared.

How Distance, Midpoint, and Slope Relate

Given two points on a coordinate plane, three related quantities describe how they relate: how far apart they are (distance), the point exactly between them (midpoint), and how steep the line connecting them is (slope). Enter both points’ x and y coordinates, and this calculator finds all three at once.

The Formulas

  • Distance: (x2x1)2+(y2y1)2\sqrt{(\vB{x_2} - \vA{x_1})^2 + (\vB{y_2} - \vA{y_1})^2} — the Pythagorean theorem applied to the horizontal and vertical gaps between the two points.
  • Midpoint: (x1+x22,y1+y22)\left(\frac{\vA{x_1} + \vB{x_2}}{2}, \frac{\vA{y_1} + \vB{y_2}}{2}\right) — the average of the two x-coordinates and the average of the two y-coordinates.
  • Slope: y2y1x2x1\frac{\vB{y_2} - \vA{y_1}}{\vB{x_2} - \vA{x_1}} — “rise over run.” Undefined when both points share the same x-coordinate (a perfectly vertical line has no defined slope).

Worked Example

Point A at (1, 2) and Point B at (4, 6):

  1. Distance: (41)2+(62)2=9+16=25=5\sqrt{(\vB{4} - \vA{1})^2 + (\vB{6} - \vA{2})^2} = \sqrt{9 + 16} = \sqrt{25} = 5
  2. Midpoint: (1+42,2+62)=(2.5,4)\left(\frac{\vA{1} + \vB{4}}{2}, \frac{\vA{2} + \vB{6}}{2}\right) = (2.5, 4)
  3. Slope: 6241=431.33\frac{\vB{6} - \vA{2}}{\vB{4} - \vA{1}} = \frac{4}{3} \approx 1.33

Key Factors to Consider

  • Point order doesn’t affect distance or midpoint, but affects how slope’s sign should be interpreted consistently. Swapping which point is “A” and which is “B” gives the same distance and the same midpoint, and mathematically the same slope value too — the slope formula naturally produces the same ratio either way, since both the numerator and denominator flip sign together.
  • A slope of zero means a perfectly horizontal line, distinct from an undefined slope’s vertical line. These are opposite special cases: zero slope means no change in y as x changes (flat); undefined slope means no change in x is possible at all (a vertical line) — don’t confuse the two.
  • This calculator works in a standard 2D Cartesian coordinate system. For 3D coordinates or a different coordinate system (polar, for instance), the distance and slope formulas would need to be adapted — this tool is specifically for the standard (x, y) plane.
  • The steepness a slope value represents isn’t linear to the eye. A slope of 1 looks like a 45-degree angle, but a slope of 2 doesn’t look “twice as steep” to the eye — the visual angle and the numeric slope value relate through an arctangent, not a simple proportion.

Common Mistakes

  • Subtracting the coordinates in a different order for the numerator and denominator of the slope formula. Both differences must come from the same point order (always y2 − y1 over x2 − x1, never mixing y2 − y1 with x1 − x2) — flipping only one of the two flips the sign of the result.
  • Treating a negative distance as meaningful. The distance formula’s square root always returns a non-negative value by convention — a “negative distance” would indicate an arithmetic mistake earlier in the calculation, not a valid geometric answer.
  • Confusing the midpoint with the slope when a problem only needs one of them. The midpoint is a location (a point), while the slope is a rate (a ratio describing steepness) — they answer different questions about the same two points and aren’t interchangeable.

Useful to Know

The slope between two points is also exactly what you’d need to find a perpendicular line: a line perpendicular to one with slope m has slope −1/m (the negative reciprocal). This calculator doesn’t compute that directly, but the slope value it reports is the only input that formula needs — useful for problems like finding a perpendicular bisector through the midpoint this calculator also provides.

Source: Standard Coordinate Geometry.

Frequently Asked Questions

Why are distance, midpoint, and slope combined into one calculator?

All three are computed from the exact same two points, so it's more useful to see them together than to look them up on three separate pages — you enter your coordinates once and get every commonly-needed answer at once.

What does an undefined slope mean?

A vertical line (where both points share the same x-coordinate) has no defined slope, since the slope formula would require dividing by zero. This calculator reports "Undefined (vertical line)" in that case rather than an error or a meaningless number.

What is the midpoint used for?

The midpoint is the exact center point between two coordinates — useful for finding the center of a line segment, splitting a distance evenly, or as a step in other geometry problems like finding a perpendicular bisector.

Can the distance between two points ever be negative?

No — distance is always zero or positive. It comes from a square root, which by mathematical convention always returns a non-negative value, regardless of which point is labeled A or B.

How do I find the slope of a line perpendicular to my two points?

Take the negative reciprocal of the slope this calculator reports: flip the fraction and change its sign. A line with slope 4/3, for example, has a perpendicular slope of -3/4.

What happens if I enter the same point twice?

The distance and the change in both x and y are all zero, the midpoint equals that same point, and the slope becomes undefined (0 ÷ 0) since there's no direction between two identical points to describe.

Confirm Your Age

To create an account, please tell us your birth month and year.