Slope Calculator (Gradient & Equation of Line)

Find slope from two points, then calculate the line equation, intercepts, distance, rise, run, and direction angle.

Two-Point Slope Line Equation Coordinate Graph
Share this tool
Point 1

Horizontal coordinate

Vertical coordinate

Point 2

Horizontal coordinate

Vertical coordinate

Quick Load:

Calculating line...

Enter two points to calculate slope, line equations, intercepts, distance, and angle.

What Is a Slope Calculator?

A Slope Calculator finds the gradient of the unique straight line through two coordinate points. It also converts that relationship into slope-intercept, point-slope, and standard equation forms while calculating rise, run, intercepts, distance, and direction angle.

Slope measures vertical change for each unit of horizontal change. A positive value rises from left to right, a negative value falls, zero produces a horizontal line, and a zero run produces a vertical line with undefined slope.

How Rise and Run Create Slope

Keep point order consistent: subtract the first y-coordinate from the second, then subtract the first x-coordinate from the second.

Rise over run slope diagramCoordinate graph showing two points joined by an increasing line, with horizontal run and vertical rise forming a right triangle. Mini examples show negative and undefined slopes. (x1, y1) (x2, y2) run = x2 - x1 rise = y2 - y1 m = rise / run Positive: m > 0 Negative Undefined
Slope types and their graph behavior
Slope typeConditionGraph behaviorExample equation
Positivem > 0Rises left to righty = 2x + 1
Negativem < 0Falls left to righty = -x + 3
Zerom = 0Horizontaly = 4
Undefinedrun = 0Verticalx = 2

How to Calculate Slope Between Two Points

For points (2, 3) and (6, 11), rise = 11 - 3 = 8 and run = 6 - 2 = 4. Therefore m = 8/4 = 2. Reversing both subtractions gives -8/-4, which produces the same slope; reversing only one subtraction gives an incorrect sign.

How to Find the Equation of a Line

After finding m, substitute either point into b = y - mx. For the example, b = 3 - 2(2) = -1, so the equation is y = 2x - 1. Substituting the second point gives the same intercept and verifies the relationship.

Slope-Intercept, Point-Slope, and Standard Form

Slope-intercept

y = mx + b

Best for reading slope and y-intercept directly.

Point-slope

y - y1 = m(x - x1)

Useful when a point and the slope are known.

Standard

Ax + By = C

Often uses reduced integer coefficients.

Positive, Negative, Zero, and Undefined Slope

Positive and negative slopes describe direction as x increases. A horizontal line has rise zero and slope zero. A vertical line has run zero, so division is impossible and its equation is written x = constant rather than y = mx + b.

Distance and Angle Between Two Points

Distance uses the Pythagorean relationship √(run² + rise²). The direction angle uses atan2(rise, run) and is normalized between 0° and 180°. Slope is a ratio, while angle is an angular measure; they describe related but different properties.

Common Slope Mistakes

Keep subtraction order consistent, do not divide run by rise, and do not call a vertical slope zero. Two identical points also require special care: they identify one location, but infinitely many lines pass through it, so no unique slope exists.

A plotted line can look steeper or flatter when horizontal and vertical axes use different visual scales. Read the numerical rise and run rather than estimating slope from appearance alone.

Slope Calculator FAQ

What is the slope formula?

The formula is m = (y2 - y1) / (x2 - x1). It divides vertical change by horizontal change using the same point order in both differences.

How do I find slope from two points?

Subtract the first y-value from the second to get rise, then do the same with the x-values to get run. Divide rise by run and simplify the fraction.

What does an undefined slope mean?

Undefined slope means the run is zero, so the line is vertical. Its equation has the form x = k and cannot be written in ordinary slope-intercept form.

What is the slope of a horizontal line?

A horizontal line has slope zero because its y-value never changes. Its equation has the form y = k.

How do I find the y-intercept from two points?

First calculate the slope, then substitute either point into b = y - mx. The intercept is the point (0, b).

How do I write an equation from two points?

Find the slope and use point-slope form with either point. Expand and simplify to obtain slope-intercept or standard form.

Can slope be a fraction or decimal?

Yes. Fraction form often preserves the exact rise-to-run ratio, while decimal form is convenient for approximation and graphing.

What is the difference between slope and angle?

Slope is the ratio rise/run and can be any real number except for vertical lines. Angle measures direction from the positive x-axis and is expressed in degrees or radians.

What happens if both points are the same?

One point does not determine a unique straight line because infinitely many lines pass through it. The calculator therefore returns an error instead of inventing a slope.

Related Calculators