Distance Formula Calculator: Distance, Midpoint and Slope Between Two Points in 2D and 3D

Type two points and get the exact distance (as a simplified radical and a decimal), the midpoint, the slope and a picture of the right triangle behind the formula. Further tabs measure from a point to a line or circle, and work out triangle and polygon areas.

Distance Formula Calculator

Pick a tab, type your numbers and press Calculate. Tap an example chip to see the working first.

The Distance Formula and Where It Comes From

The distance between (x₁, y₁) and (x₂, y₂) is d = √[(x₂ − x₁)² + (y₂ − y₁)²]. It is Pythagoras' theorem in disguise: the horizontal gap and the vertical gap are the two legs of a right triangle, and the distance is the hypotenuse.

Distance from (1, 2) to (7, 10)

  1. Horizontal gap: 7 − 1 = 6. Vertical gap: 10 − 2 = 8.
  2. d = √(6² + 8²) = √(36 + 64) = √100.

Answer: d = 10

Distance from (0, 0) to (5, 5)

  1. d = √(25 + 25) = √50.
  2. √50 = √(25 × 2) = 5√2.

Answer: 5√2 ≈ 7.0711

Distance in 3D

Add the third gap: d = √[(Δx)² + (Δy)² + (Δz)²]. From (1, 2, 3) to (4, −2, 15): Δ = (3, −4, 12), so d = √(9 + 16 + 144) = √169 = 13. From (0, 0, 0) to (2, 3, 6) is √(4 + 9 + 36) = 7. Many 3D examples come out whole because of Pythagorean quadruples like (2, 3, 6, 7).

Midpoint and Dividing a Segment in a Ratio

The midpoint averages the coordinates: for (−2, 3) and (6, 7) it is (2, 5). To split a segment in a ratio m : n measured from the first point, use ((m·x₂ + n·x₁)/(m + n), (m·y₂ + n·y₁)/(m + n)). With 2 : 3 on the same points you get (6/5, 23/5). The calculator also finds trisection points, external division points, and an unknown endpoint given the midpoint: if A(1, 1) and the midpoint is (4, 5), then B = (7, 9).

Distance from a Point to a Line

The shortest distance from (x₀, y₀) to the line Ax + By + C = 0 is |Ax₀ + By₀ + C| ÷ √(A² + B²). For the point (3, 4) and the line 2x − y + 1 = 0, the top is |6 − 4 + 1| = 3 and the bottom is √5, so d = 3/√5 = 3√5/5 ≈ 1.342. The calculator also gives the foot of the perpendicular, which is the closest point on the line.

For two parallel lines use the same idea with the constants: 3x + 4y = 5 and 3x + 4y = 15 are |15 − 5| ÷ √(3² + 4²) = 10 ÷ 5 = 2 apart.

Point and Circle

Measure from the point to the centre. If that distance exceeds the radius, the shortest distance to the circle is the distance minus the radius, and the tangent length is √(d² − r²). A point (7, 1) and a circle with centre (1, 1) and radius 4 are 6 from the centre, so the gap to the circle is 2 and the tangent length is √20 = 2√5.

Triangle and Polygon Measurements

Three vertices give three distances. The calculator then finds the perimeter, area (by the shoelace formula), the angles, whether it is right, acute or obtuse, and the centroid, circumcentre and orthocentre. For (0, 0), (6, 0), (2, 5) the area is 15 and the perimeter is 6 + √29 + √41 ≈ 17.79. The Polygon tab applies the shoelace formula to up to ten vertices in order.

Find an Unknown Coordinate

If A is (1, 2), B is (x, 6) and the distance is 5, then (x − 1)² + 16 = 25, so x − 1 = ±3 and x = −2 or 4. Two answers are normal: B can be on either side of A. If the distance is too small to reach, as with (0, 0), (x, 10) and d = 6, there is no real solution.

Our Take: What Is Overrated, Underrated and Plain Wrong

Overrated: memorising the formula as a separate fact. It is the Pythagorean theorem on the horizontal and vertical gaps.

Underrated: leaving the answer as an exact surd. √50 = 5√2 is more useful than 7.07 when you continue working.

Plain wrong: using the flat formula for latitude and longitude. Over long distances Earth is curved, so GPS distances use the haversine formula instead. New York to Los Angeles is roughly 3,900 km along the surface.

A Worked Example With Real Numbers

From (1, 2) to (7, 10): the horizontal gap is 6 and the vertical gap is 8, so d = √(36 + 64) = √100 = 10. That is the 6-8-10 right triangle, a scaled 3-4-5. The midpoint is (4, 6).

Practice with Answers

  1. Distance from (−3, 4) to (2, −8)
    Answer13
  2. Midpoint of (4, −2) and (10, 8)
    Answer(7, 3)
  3. Distance from (0, 0) to the line 3x + 4y = 10
    Answer2
  4. Distance between (1, 1, 1) and (3, 3, 2)
    Answer3
  5. Area of the triangle (0, 0), (4, 0), (0, 3)
    Answer6

Why Students Get Stuck on The Distance Formula, and What a Good Calculator Should Do

Searching for help with the Distance Formula usually starts late at night with one problem that will not work out. It is the Pythagorean theorem in disguise, and the signs get tangled. A good calculator fixes that by showing each step, checking its own answer and explaining the idea in plain words. This section covers what students struggle with, what they want, and how this page responds.

In short: students need to see the right triangle behind the formula and use it for distance and midpoint, not just see a final number, and a calculator earns trust only when its steps can be checked.

Understand the frustrations and desires

What they feel, and what they want

Each frustration points to a wish: a clearer step, a built-in check, an explanation in plain words.

  • Wants distance, midpoint and slope in one go
  • Wants a sketch of the segment
  • Wants the radical simplified

Build the page around their intent

Each intent has a place on this page

The page follows intent, not features, so each need has a clear starting point.

  • I need an answer now: type the problem into the calculator at the top of this page.Distance between (1,2) and (4,6)
  • I need to understand: the sections below explain the idea in plain words and list the common mistakes.
  • I need to check my work: every step is shown, so the first line that differs from yours is the one to study.
  • I need practice: open the solver, tap + and choose Create Practice Test.
  • I need it explained aloud: in the solver, tap + and choose Create Video.

Distance Formula: Questions People Ask

Is the distance formula the same as the Pythagorean theorem?

Yes. The differences in x and y are the two legs of a right triangle, and the distance is its hypotenuse.

Can the distance be negative?

No. It is a square root of a sum of squares, so it is never negative.

Does it matter which point I enter first?

No. Squaring removes the sign, so you get the same distance either way.

How do I get an exact answer instead of a decimal?

The calculator gives both, such as 5√2 and 7.0711. Use the radical form if your teacher wants it exact.

How is a point-to-line distance different from the distance between two points?

It is the shortest distance, measured along the perpendicular, so it uses a different formula based on the line's coefficients.

Can it handle three dimensions?

Yes, switch to the 3D tab and enter x, y and z for both points.

What is the distance formula?

d = √((x₂ − x₁)² + (y₂ − y₁)²). In 3D add (z₂ − z₁)² under the root.

Does the order of the points matter?

No. Squaring removes the sign, so the distance from A to B equals the distance from B to A.

How is the distance formula related to the Pythagorean theorem?

The horizontal and vertical gaps are the legs of a right triangle, and the distance is its hypotenuse.

↑