UtilityBase logoUtilityBase

3 min read

How to Find the Slope Between Two Points

Learn how slope, the line equation, distance, and midpoint come from two points, then plug in coordinates and see the line graphed for you.

Slope is rise over run

Slope measures how steep a line is and in which direction it tilts. Given two points, you find it by dividing the change in the vertical direction, called the rise, by the change in the horizontal direction, called the run. In symbols, slope equals the difference of the y values divided by the difference of the x values.

A positive slope rises from left to right, a negative slope falls, a slope of zero is a flat horizontal line, and a vertical line has an undefined slope because its run is zero and you cannot divide by zero. Keeping the two points in the same order for both the top and bottom of the fraction prevents a common sign error.

From slope to the equation of the line

Once you know the slope and one point, you can write the whole line. The slope-intercept form, y equals m x plus b, uses the slope m and the y-intercept b, which is where the line crosses the vertical axis. You get b by plugging a known point and the slope into the equation and solving.

The point-slope form is often quicker as a first step because it drops your slope and one point straight in without solving for the intercept. Both forms describe the same line, so use whichever your assignment or problem asks for.

Distance and midpoint from the same two points

The two points that give you a slope also give you the distance between them and the point exactly halfway along. The distance comes from the Pythagorean theorem: square the horizontal change, square the vertical change, add them, and take the square root. It is always positive because it is a length.

The midpoint is simpler still: average the two x values to get its x, and average the two y values to get its y. Distance and midpoint show up in geometry, mapping, and design work, and computing all of these at once saves you from repeating the same subtractions.

Using the slope calculator step by step

The calculator runs in your browser and draws the line for you, so you can sanity check the numbers against the picture.

  1. 1Open the slope calculator and enter the x and y values of your first point.
  2. 2Enter the x and y values of your second point.
  3. 3Read the slope, shown as a fraction or decimal, along with the sign that tells you the direction.
  4. 4Check the generated line equation in slope-intercept form.
  5. 5Note the distance between the points and the coordinates of the midpoint.
  6. 6Look at the graphed line to confirm the slope matches the tilt you expected.

Reading the results with confidence

If the tool reports an undefined slope, your two points share the same x value, which means the line is vertical. A slope of zero means they share the same y value and the line is horizontal. Neither is an error; both are meaningful answers.

Use the graph as a quick check. A steep line should show a slope well above one or below negative one, while a gentle line sits closer to zero. If the picture and the number disagree, you probably swapped a coordinate, so re-enter the points.

Frequently asked questions

What does an undefined slope mean?

An undefined slope happens when the two points have the same x value, making the line perfectly vertical. The run is zero, and dividing the rise by zero is not defined. It is a real and correct result, not a mistake, and it simply tells you the line goes straight up and down.

Does the order of the points matter?

The order does not change the final slope as long as you are consistent: subtract the coordinates in the same order on the top and bottom of the fraction. If you flip the points for the rise but not the run, you will get the wrong sign. Distance is unaffected, and the midpoint is the same either way.

How is the distance between the points calculated?

Distance uses the Pythagorean theorem. The horizontal and vertical gaps between the points form the two legs of a right triangle, and the straight-line distance is the hypotenuse. Square each gap, add them, and take the square root. The result is always a positive length.

Tools mentioned in this guide

Keep reading