Skip to content
Mathematics

Two points and their line

Calculate the distance, midpoint, slope and intercept of the straight line defined by two points.

Free & no registration Calculated in your browser
01

Your inputs

The starting values are an example.

Decimals: 12.5 · Thousands: 1,234.56. Follow the field instructions for lists.

02

Your result

Enter your values and select Calculate.

Your calculation will appear here.

Your result will include the relevant values and units.

Understand the calculation

Formula and example

How it is calculated

Distance=√[(x₂−x₁)²+(y₂−y₁)²]. Midpoint=((x₁+x₂)/2;(y₁+y₂)/2). Slope=(y₂−y₁)/(x₂−x₁).

Worked example

The distance between (0;0) and (3;4) is 5 length units. The midpoint is (1.5;2) and the slope is 4/3.

Things to check

  • Both axes use the same length unit in a flat Cartesian coordinate system.
  • Equal x coordinates give a vertical line. Two identical points do not define a unique line.

Frequently asked questions

What does LU mean?

LU means length unit. You can use centimetres, metres or an abstract coordinate unit, provided both axes use the same unit.