Distance & Midpoint Calculator — Distance, Midpoint & Slope
How far apart are (3,4) and (7,1)? Exactly 5 units — dx = 4, dy = −3, so d = √(16 + 9) = √25 = 5. Their midpoint is (5, 2.5) and the segment's slope is −3/4. This free distance and midpoint calculator shows every step of the distance formula, the midpoint formula and the slope formula, so you can check the working by hand.
Distance & Midpoint Calculator: Distance, Midpoint & Slope
Enter two points once — pick the mode that matches your question. Calculations run in your browser.
What Is a Distance & Midpoint Calculator?
A distance and midpoint calculator answers three questions about any two points on a coordinate plane: how far apart are they, what point sits exactly halfway between them, and how steep is the segment joining them? Give it (3,4) and (7,1) and it finds dx = 4 and dy = −3, so the distance is √(4² + (−3)²) = √(16 + 9) = 5; the midpoint is (5, 2.5); and the slope is −3/4. Every answer shows the step-by-step working, so you can check it by hand.
How to Use the Distance & Midpoint Calculator
The tool has three modes so you can start with whatever your question is — the same two points feed all three.
- Choose a mode that matches your question (or tap a preset to load a worked example).
- Enter your two points — x₁, y₁, x₂, y₂ (decimals and negatives are fine).
- Select Calculate to generate the result cards.
- Read the note under the cards for the step-by-step working and a check you can verify by hand.
The built-in check re-derives the answer a second way — the distance squared against dx² + dy², the midpoint's distance to each endpoint, or the slope checked against the line equation — so a wrong keystroke shows up immediately.
What Is Distance, Midpoint and Slope?
Distance is the straight-line length between two points. Midpoint is the point exactly halfway along the segment joining them. Slope is how steep that segment is — its rise over its run. All three come from the same two gaps, dx and dy.
The distance formula is the Pythagorean theorem in disguise: dx and dy are the legs of a right triangle, and the distance is its hypotenuse. That is why the formula squares both gaps — a negative dy still contributes a positive square, so the distance is always positive. The midpoint formula is simpler: average the x-coordinates and average the y-coordinates, and you land exactly halfway. The table below covers the three answers for the hero pair.
| Quantity | Formula | For (3,4) and (7,1) | Meaning |
|---|---|---|---|
| Distance | √((x₂−x₁)² + (y₂−y₁)²) | √(4² + (−3)²) = √25 = 5 | 5 units apart |
| Midpoint | ((x₁+x₂)/2, (y₁+y₂)/2) | ((3+7)/2, (4+1)/2) = (5, 2.5) | Exactly halfway — 2.5 units from each end |
| Slope | (y₂−y₁)/(x₂−x₁) | (1−4)/(7−3) = −3/4 | Falls 3 units for every 4 units right |
Why the Midpoint Is Exactly Halfway
Averaging the coordinates splits each gap in half: the midpoint's x is 4 units from 3 and 4 units from 7 in the x-direction, halved to 2 units each way; its y is 3 units apart, halved to 1.5. The distance from (3,4) to the midpoint (5, 2.5) is √(2² + (−1.5)²) = √(4 + 2.25) = √6.25 = 2.5 — and the same 2.5 from the midpoint to (7,1). Two equal legs, totalling the full distance of 5. If the two legs ever disagree, a number was entered wrong.
Distance, Slope and the Coordinate Plane
Distance and slope describe the same segment from two angles: distance is its length, slope is its direction. A segment can be long and flat (large distance, slope near 0), short and steep (small distance, large slope), or vertical (any distance, slope undefined — the run is zero). The midpoint is the segment's centre, and it is the same point whether you travel from the first point or the second — averaging is symmetric, so point order never matters for distance or midpoint, and it never matters for slope either, as long as you subtract in the same order top and bottom.
Distance & Midpoint Calculator Worked Examples
Every row below is computed exactly — hand-verified in Python — so you can check each one by hand.
| Points | dx, dy | Distance | Midpoint | Slope |
|---|---|---|---|---|
| (3,4) and (7,1) | 4, −3 | √(16+9) = 5 | (5, 2.5) | −3/4 |
| (0,0) and (3,4) | 3, 4 | √(9+16) = 5 | (1.5, 2) | 4/3 |
| (1,2) and (4,6) | 3, 4 | √(9+16) = 5 | (2.5, 4) | 4/3 |
| (2,1) and (2,5) | 0, 4 | √(0+16) = 4 | (2, 3) | Undefined (vertical) |
| (−1,−2) and (2,2) | 3, 4 | √(9+16) = 5 | (0.5, 0) | 4/3 |
| (0,0) and (6,8) | 6, 8 | √(36+64) = 10 | (3, 4) | 4/3 |
| (5,5) and (9,8) | 4, 3 | √(16+9) = 5 | (7, 6.5) | 3/4 |
The 3-4-5 Pattern: Why So Many Distances Are Exactly 5
Five of the seven rows above have distance exactly 5 — because each one hides a 3-4-5 right triangle: legs 3 and 4, hypotenuse 5. Any pair of points whose dx and dy are 3 and 4 (in either order, with either sign) sits exactly 5 units apart. Double both legs to 6 and 8 and the distance doubles to 10. Spotting the 3-4-5 pattern is the fastest mental check there is: if dx and dy are 3 and 4, the answer is 5 before you even reach for the square root.
How to Find the Distance and Midpoint, Step by Step
Follow this recipe for the classic example — (3,4) and (7,1).
- Label the points: (x₁,y₁) = (3,4), (x₂,y₂) = (7,1).
- Find dx: x₂ − x₁ = 7 − 3 = 4.
- Find dy: y₂ − y₁ = 1 − 4 = −3.
- Square both: 4² = 16 and (−3)² = 9. (The square kills the minus sign — that is why distance is always positive.)
- Add: 16 + 9 = 25.
- Take the square root: √25 = 5. The distance is 5 units.
- Midpoint: x = (3 + 7)/2 = 5, y = (4 + 1)/2 = 2.5 → (5, 2.5).
- Slope: m = dy/dx = −3/4.
- Check: the midpoint is 2.5 units from each endpoint (√(2² + (−1.5)²) = 2.5), and 2.5 + 2.5 = 5 ✓ — the full distance.
Common Mistakes With Distance and Midpoint
1. Forgetting to square before adding
The classic. d is NOT |dx| + |dy| — for (3,4)–(7,1) that would give 4 + 3 = 7, not 5. The formula squares first, adds, then takes the square root: √(16 + 9) = 5. Adding the raw gaps is the Manhattan distance (walking city blocks), not the straight-line distance.
2. Swapping x and y in the midpoint
The midpoint of (3,4) and (7,1) is (5, 2.5) — average the x's for the x, average the y's for the y. Averaging 3 with 1 and 4 with 7 instead gives (2, 5.5), a point nowhere near the segment. Keep each coordinate with its own kind.
3. Dropping the sign on dy (or dx) in the slope
dy = 1 − 4 = −3, so the slope is −3/4 — negative, falling left to right. Using 4 − 1 = 3 gives +3/4, the mirror image of the real segment. The sign is the direction; lose it and the line tilts the wrong way. (The sign does not matter for distance — (−3)² = 9 either way — but it is everything for slope.)
4. Saying a vertical segment has slope 0
Zero slope is flat (horizontal, e.g. (1,4)–(5,4): m = 0). A vertical segment like (2,1)–(2,5) has run = 0, so slope = 4/0 — undefined, not zero. Its distance (4) and midpoint ((2, 3)) are still perfectly well defined.
5. Subtracting in different orders for rise and run
Slope needs the same point order top and bottom: (1 − 4)/(7 − 3) = −3/4. Mixing orders — (1 − 4)/(3 − 7) — flips both signs and accidentally gives the same answer here, but (4 − 1)/(7 − 3) = +3/4 is the sign error from mistake #3. Pick point 1 and point 2, then use that order everywhere.
6. Forgetting the square root at the end
√(16 + 9) = √25 = 5 — the last step matters. Stopping at 25 reports the squared distance, which is not a length at all. Always finish with the square root, and sanity-check: the distance must be at least as big as |dx| and |dy| (here 5 ≥ 4 and 5 ≥ 3 ✓) and no bigger than |dx| + |dy| (5 ≤ 7 ✓).
Benefits and Limitations
Benefits
- Finds the distance between any two points, with the full distance-formula working.
- Finds the midpoint with the average-of-coordinates working, plus the halfway check (equal legs).
- Finds the slope as an exact fraction (−3/4, 4/3), not just a rounded decimal.
- Handles vertical segments (undefined slope) and identical points (distance 0) gracefully, instead of crashing or showing 0.
- Presets load the landmark examples — the hero (3,4)–(7,1) pair, the 3-4-5 triangles, and the vertical case — with one tap.
- Responsive on phones, tablets and desktops.
Limitations
- Two-dimensional points only — it does not compute 3D distance (which adds a dz² term).
- Decimal answers are shown to four places internally; slopes are exact fractions where the input is exact.
- Very large coordinates (above ~10^15) can lose precision in browser floating point.
Quick Definitions
| Question | Direct Answer |
|---|---|
| What is a distance and midpoint calculator? | A tool that finds the distance, midpoint and slope between two points. (3,4)–(7,1): distance 5, midpoint (5, 2.5), slope −3/4. |
| What is the distance formula? | d = √((x₂ − x₁)² + (y₂ − y₁)²). For (3,4)–(7,1): √(4² + (−3)²) = √25 = 5. |
| What is the midpoint formula? | M = ((x₁ + x₂)/2, (y₁ + y₂)/2). For (3,4)–(7,1): ((3+7)/2, (4+1)/2) = (5, 2.5). |
| What is the slope of a line segment? | m = (y₂ − y₁)/(x₂ − x₁) = rise/run. For (3,4)–(7,1): (1−4)/(7−3) = −3/4. |
| What is the distance between (3,4) and (7,1)? | 5 units. dx = 4, dy = −3, so d = √(16 + 9) = √25 = 5. |
| What is the midpoint of (3,4) and (7,1)? | (5, 2.5). Average the coordinates: (3+7)/2 = 5 and (4+1)/2 = 2.5. It sits exactly 2.5 units from each endpoint. |
| When is slope undefined? | When the segment is vertical — the run x₂ − x₁ is zero. (2,1)–(2,5) has slope undefined, distance 4, midpoint (2, 3). |
| What is the distance between two identical points? | 0. The points are the same point, so dx = 0 and dy = 0, and the midpoint is the point itself. The slope is undefined (0/0). |
Frequently Asked Questions
What is the distance between (3,4) and (7,1)?
5 units. dx = 7 − 3 = 4, dy = 1 − 4 = −3, so d = √(4² + (−3)²) = √(16 + 9) = √25 = 5.
What is the midpoint of (3,4) and (7,1)?
(5, 2.5). Average the coordinates: x = (3 + 7)/2 = 5, y = (4 + 1)/2 = 2.5. The midpoint sits exactly 2.5 units from each endpoint, and 2.5 + 2.5 = 5 ✓.
What is the slope of the segment from (3,4) to (7,1)?
−3/4. Slope m = (y₂ − y₁)/(x₂ − x₁) = (1 − 4)/(7 − 3) = −3/4. The segment falls 3 units for every 4 units it moves right.
What is the distance formula?
d = √((x₂ − x₁)² + (y₂ − y₁)²). It is the Pythagorean theorem applied to the horizontal and vertical gaps between the points: dx and dy are the legs of a right triangle, and the distance is its hypotenuse.
How do you find the midpoint of a line segment?
Average the coordinates: M = ((x₁ + x₂)/2, (y₁ + y₂)/2). For (3,4) and (7,1): M = ((3+7)/2, (4+1)/2) = (5, 2.5). The midpoint is the point exactly halfway along the segment.
What is the slope of a vertical line segment?
Undefined. A vertical segment like (2,1) to (2,5) has run x₂ − x₁ = 0, so slope = rise/run divides by zero. Its distance is still defined (4 units) and its midpoint is (2, 3).
Related Math Tools
Distance & Midpoint Calculator Methodology
This calculator derives every answer from the three standard coordinate-geometry formulas, using exact decimal arithmetic and converting slopes to fractions where they are exact.
Distance is computed as the square root of dx² + dy², where dx = x₂ − x₁ and dy = y₂ − y₁; for the hero pair (3,4)–(7,1), dx = 4 and dy = −3, so d = √(16 + 9) = 5. The midpoint averages each coordinate separately — (3+7)/2 = 5 and (4+1)/2 = 2.5 — and is cross-checked by measuring its distance to each endpoint (2.5 and 2.5, summing to the full distance of 5). Slope is the ratio dy/dx, shown as an exact fraction by continued-fraction approximation (tolerance 10⁻⁹, denominators up to 1000): −3/4 for the hero pair, 4/3 for (0,0)–(3,4). A zero run is detected before any division and reported as an undefined slope, with the distance and midpoint still computed; identical points give distance 0, midpoint equal to the point itself, and an undefined slope (0/0). The page is intended as an educational calculator and verification tool.
Mathematical References
How Far Apart Are Your Points?
Enter two points above — (3,4) and (7,1), or your own — and get the distance, midpoint and slope with every step shown. Watch for the 3-4-5 pattern: if dx and dy are 3 and 4, the distance is 5.
Use Distance & Midpoint Calculator