Skip to content

How steep is the line through two points?

Slope, equation, distance, midpoint and angle of the line through two points.

Slope

m = 3/4 = 0.75

From (1, 2) to (5, 5) the line rises 3 over a run of 4: y = 0.75x + 1.25.

Key values as a table
Pointxy
A12
B55
M33.5
Equation
y = 0.75x + 1.25
y-intercept
(0, 1.25)
Distance
5
Midpoint
(3, 3.5)
Angle to the x-axis
36.8699°

Slope, equation, distance, midpoint and angle of the line through two points.

How to use

  1. Type the coordinates of two points, A (x₁, y₁) and B (x₂, y₂).
  2. Read the slope, the equation of the line, the distance, the midpoint and the angle.
  3. Drag A or B anywhere and watch the slope triangle, the equation and the angle follow.

How it works

The slope tells how steep a straight line is: how much it goes up (the rise) for each step to the right (the run). A slope of 2 climbs two units for every one across, a negative slope goes downhill, 0 is flat, and a vertical line has no slope at all because its run is zero.

Through A(x₁, y₁) and B(x₂, y₂) the slope is m = (y₂ − y₁) / (x₂ − x₁). The line is then y = mx + b, where the y-intercept b = y₁ − m·x₁ is where it crosses the y-axis. From (1, 2) to (5, 5) the rise is 3 and the run 4, so m = 3/4 = 0.75 and y = 0.75x + 1.25.

The rise and run are the two legs of a right triangle, so the distance between the points is √(run² + rise²) by Pythagoras: 5 in the example. The midpoint averages the coordinates, and the angle to the x-axis is the arctangent of the slope (36.87°). Results are rounded to six significant digits. Source: OpenStax College Algebra 2e, sections 2.1 and 4.1.

Worked example

What is the slope of the line through (1, 2) and (5, 5)?

  1. Rise = 5 − 2 = 3; run = 5 − 1 = 4.
  2. m = rise ÷ run = 3 ÷ 4 = 0.75.
  3. Intercept: b = 2 − 0.75 × 1 = 1.25. The angle is 36.87° and the points are 5 apart.

Slope 0.75: y = 0.75x + 1.25.

Frequently asked questions

Can I enter decimal or negative coordinates?

Yes. Each coordinate can be a decimal or a negative number within the input limits. A reduced fraction is shown when the rise and run are whole numbers.

Does it matter which point is A?

No. Swapping the points changes the sign of both the rise and the run, so their ratio, the slope, stays the same, and so do the distance and the midpoint.

How do I turn a slope into a percentage grade?

Multiply it by 100. A slope of 0.08 is an 8 % grade: the road climbs 8 m for every 100 m across.

How can I check whether two lines are perpendicular?

For two non-vertical lines, their slopes multiply to −1. A horizontal line and a vertical line are also perpendicular, although the vertical line has no numerical slope.

What happens if I enter the same point twice?

One point does not determine a unique line. The distance is zero and the midpoint is that point, but there is no unique slope or line equation.

Send feedback