Skip to content
Tezmy Tools

Slope Calculator

Slope, equation, distance and midpoint from two points

Enter the coordinates of two points to get the slope, the equation of the line, the distance and more.

Runs in your browser. Nothing is uploaded.

About the Slope Calculator

Slope Calculator takes the coordinates of two points and describes the straight line through them. It gives the slope as a decimal and, for whole-number points, as a simplified fraction, the equation of the line in slope-intercept form (y = mx + b) and in standard form (Ax + By = C), the x- and y-intercepts, the distance between the points, the midpoint, the angle of the line with the x-axis, the grade in percent and the slope of a perpendicular line. A small graph, drawn to scale, shows both points and the line. Vertical lines, which have an undefined slope, and horizontal lines are handled and explained. The tool works with negative numbers and decimals, and everything runs in your browser.

Updated September 2026

How to use the Slope Calculator

  1. 1Enter the x and y coordinates of the first point, x₁ and y₁.
  2. 2Enter the x and y coordinates of the second point, x₂ and y₂.
  3. 3Read the slope in the big box, and its fraction form if there is one.
  4. 4Copy the equation of the line, or read the standard form.
  5. 5Use the smaller boxes for the distance, midpoint, angle and intercepts.

What slope means

Slope measures how steep a line is and in which direction it goes. It is the rate of change of y compared with x, so in a graph of distance against time it is the speed, and in a graph of cost against quantity it is the price per item. Two points are all it takes to work it out.

The same idea appears in everyday places: the pitch of a roof, the grade of a road or a wheelchair ramp, the incline of a treadmill, and the trend line through a set of data.

Forms of the line equation

  • Slope-intercept form: y = mx + b, with m the slope and b the point where the line crosses the y-axis.
  • Point-slope form: y − y₁ = m(x − x₁), handy when you know a point and the slope.
  • Standard form: Ax + By = C, with whole numbers when possible.
  • Vertical lines: x = a number, since they have no slope-intercept form.
  • Horizontal lines: y = a number, with slope 0.

The extra results

The distance between the points is found with the Pythagorean theorem, and the midpoint is the average of the x values and the average of the y values. The angle is measured from the positive x-axis, between −90 and 90 degrees, and the grade is the slope in percent. The intercepts show where the line crosses each axis, and horizontal lines have no x-intercept (unless they lie on the axis itself) while vertical lines have no y-intercept.

The graph always includes the origin, so the axes are visible, and it is scaled so that the picture is not stretched. That way, a 45-degree line looks like one.

Tips and related tools

Type the points carefully, since swapping x and y is the most common mistake. The result does not change if you swap the two points, as long as you swap both coordinates of each. For more geometry, Pythagorean Theorem Calculator, Triangle Calculator and Circle Calculator cover the related shapes, and Angle Converter changes the angle into radians.

To scale a rise and a run to another size, keeping the same steepness, Ratio Calculator finds the missing number in a proportion.

Features

  • Slope as a decimal and as a simplified fraction
  • Equation in y = mx + b and Ax + By = C form
  • x-intercept and y-intercept
  • Distance, midpoint and angle of the line
  • Grade in percent and the perpendicular slope
  • Graph drawn to scale
  • Handles vertical and horizontal lines

Frequently asked questions

How do you find the slope of a line?

Divide the change in y by the change in x: m = (y₂ − y₁) ÷ (x₂ − x₁). The points (1, 2) and (4, 8) give a slope of (8 − 2) ÷ (4 − 1) = 6 ÷ 3 = 2. This is often called rise over run, because y changes by the rise while x changes by the run.

What is the equation of a line through two points?

First find the slope m, then use one point to find the y-intercept b with b = y − m × x. The equation is y = mx + b. For (1, 2) and (4, 8), m = 2 and b = 2 − 2 × 1 = 0, so the line is y = 2x. The tool shows this, and the standard form, at once.

What does an undefined slope mean?

When both points have the same x value, the run is zero and the division is not possible. The line is vertical, its equation is x = a constant, and its slope is called undefined. A horizontal line has a slope of zero.

What does a negative slope mean?

It means the line goes down as you move to the right. A slope of −3 means y drops by 3 for every 1 step in x. Positive slopes rise to the right, and larger numbers mean steeper lines.

How do I find the slope of a perpendicular line?

Take the negative reciprocal of the slope: flip the fraction and change its sign. A line with slope 2 has a perpendicular slope of −1/2. The tool shows this value under the results. A vertical line is perpendicular to a horizontal one.

How do I turn slope into a percentage or an angle?

Multiply the slope by 100 for the percent grade, so a slope of 0.08 is an 8 percent grade, as used for roads and ramps. The angle is the arctangent of the slope, and the tool shows it in degrees. A slope of 1 is 45 degrees and 100 percent.

Related tools