Share
WhatsAppFacebookX (Twitter)TelegramLinkedInE-mail
EN
EnglishPortuguêsEspañolFrançais
← BackHome › Everyday › Distance, Midpoint and Slope Calculator

Distance, Midpoint and Slope Calculator

By the CalcMundi team · Updated October 22, 2026 · Formulas checked against standard financial math

Type the coordinates of two points to get the distance between them, the midpoint and the line through them.

Formulas

  • Distance: d = √((x₂ − x₁)² + (y₂ − y₁)²)
  • Midpoint: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
  • Slope: m = (y₂ − y₁) ÷ (x₂ − x₁)
  • Line: y = mx + b, where b = y₁ − m·x₁

Example

For the points (1, 2) and (4, 6): distance 5, midpoint (2.5, 4), slope 1.3333 and line y = 1.3333x + 0.6667, or 4x − 3y + 2 = 0 in general form.

The distance formula is the Pythagorean theorem applied to the horizontal and vertical gaps between the points.

Frequently asked questions

What if x₁ = x₂?

The line is vertical. Its slope is undefined and its equation is x = x₁.

What does a negative slope mean?

The line goes down from left to right. A slope of 0 is a horizontal line.

How do I know if two lines are parallel or perpendicular?

Parallel lines have the same slope. Perpendicular lines have slopes whose product is −1, like 2 and −1/2.

See also

Add this calculator to your website

Free for blogs, real estate agents, brokers and any site. Paste this code where you want the calculator to appear. It adjusts its height on its own.

Results are estimates for information only and are not financial, legal or medical advice. Rates, taxes and fees vary — confirm with a professional or your lender.