Slope Calculator

  • Free
  • No sign-up
  • Works on phones
  • Shows the working
Algebra & Trig#29

Slope & Line Equation

Slope \(m = \frac{y_2 - y_1}{x_2 - x_1}\) through two points, plus point-slope, slope-intercept and standard form.

This slope calculator finds the slope of the line through two points and writes the equation of that line three ways: point-slope form, slope-intercept form \( y = mx + b \) and standard form \( Ax + By = C \). It also gives the angle the line makes with the x-axis and handles vertical lines, whose slope is undefined.

Fractions are kept exact, so a slope of \( -\frac12 \) is shown as a fraction rather than \( -0.5 \). It’s free, runs in your browser and needs no sign-up.

How to use the slope calculator

  1. Enter the first point as x₁ and y₁.
  2. Enter the second point as x₂ and y₂. Order doesn’t matter: swapping the points gives the same slope.
  3. Press Find slope.
  4. Read the slope \( m \), then the three forms of the line. Copy whichever form your class uses.

Formula

Slope is rise over run, the change in y divided by the change in x:

$$m = \frac{y_2 - y_1}{x_2 - x_1}$$

Once you have \( m \), the point-slope form uses either point:

$$y - y_1 = m(x - x_1)$$

Solving for y gives the slope-intercept form \( y = mx + b \), where \( b \) is the y-intercept. The angle with the positive x-axis is \( \theta = \arctan m \).

SlopeLine
\( m > 0 \)Rises from left to right
\( m < 0 \)Falls from left to right
\( m = 0 \)Horizontal, \( y = \text{constant} \)
UndefinedVertical, \( x = \text{constant} \)

Worked example: positive slope

Find the line through \( (1, 2) \) and \( (4, 11) \), the points in the calculator above.

Slope. \( m = \frac{11 - 2}{4 - 1} = \frac{9}{3} = 3 \).

Point-slope form. \( y - 2 = 3(x - 1) \).

Slope-intercept form. Expand: \( y = 3x - 3 + 2 = 3x - 1 \).

Standard form. \( 3x - y = 1 \). The angle is \( \arctan 3 \approx 71.57^\circ \).

Worked example: negative fractional slope

Through \( (-2, 3) \) and \( (4, 0) \): \( m = \frac{0 - 3}{4 - (-2)} = \frac{-3}{6} = -\frac12 \). Using the first point, \( y - 3 = -\frac12(x + 2) \), so \( y = -\frac12x + 2 \). Multiply by 2 and rearrange for standard form: \( x + 2y = 4 \).

Worked example: vertical line

Through \( (3, 1) \) and \( (3, 7) \) the run is \( 3 - 3 = 0 \), and you can’t divide by zero. The slope is undefined and the line is \( x = 3 \).

Tips and common mistakes

  • Mixing the order. Use the same point first on top and bottom. \( \frac{y_2 - y_1}{x_1 - x_2} \) flips the sign.
  • Subtracting negatives. \( 4 - (-2) = 6 \), not 2.
  • Zero slope vs no slope. A horizontal line has slope 0. A vertical line has undefined slope.
  • Parallel and perpendicular lines. Parallel lines share a slope. Perpendicular slopes multiply to \( -1 \), so the perpendicular to \( m = 3 \) has \( m = -\frac13 \).

From slope to derivatives

The slope between two points on a curve is the slope of a secant line. Slide the second point toward the first and the secant becomes the tangent line; its slope is the derivative. That’s the idea behind the equation of a tangent line and the tangent line calculator, which computes \( f'(a) \) and builds \( y - f(a) = f'(a)(x - a) \) for you.

Related guides

Further reading

FAQ

How do you find the slope from two points?

Subtract the y-values and divide by the difference of the x-values in the same order: \( m = \frac{y_2 - y_1}{x_2 - x_1} \).

What is the slope of a vertical line?

It’s undefined, because the run \( x_2 - x_1 \) is zero. The equation of a vertical line is \( x = c \).

How do I turn point-slope form into y = mx + b?

Distribute the slope and add \( y_1 \) to both sides. \( y - 2 = 3(x - 1) \) becomes \( y = 3x - 1 \).

What does the angle output mean?

It’s the angle between the line and the positive x-axis, \( \arctan m \), in degrees. Negative angles mean the line falls from left to right.

Embed this calculator on your website

Teachers, tutors and bloggers are welcome to use this calculator for free. Copy the code below and paste it into any page (in WordPress, use a "Custom HTML" block). The small script makes the calculator grow to fit its answer; if your site removes scripts, it still works at a fixed height. Please keep the credit link.

More calculators

See all calculators