Skip to content
Calcapedia
Math

Slope Calculator

Find the slope, line equation, y-intercept, distance, angle and midpoint for two points.

Level: Grades 8–9

  • Common Core standard 8.F.B.4Construct a function to model a linear relationship between two quantities. Determine the rate of change and initial value of the function from a description of a relationship or from two (x, y) values, including reading these from a table or from a graph. Interpret the rate of change and initial value of a linear function in terms of the situation it models, and in terms of its graph or a table of values.
  • Common Core standard 8.EE.B.6Use similar triangles to explain why the slope m is the same between any two distinct points on a non-vertical line in the coordinate plane; derive the equation y = mx for a line through the origin and the equation y = mx + b for a line intercepting the vertical axis at b.
  • Common Core standard 8.G.B.8Apply the Pythagorean Theorem to find the distance between two points in a coordinate system.
Printable worksheet

Slope Calculator

Know the answer you need? Pick an input to work backward.

Inputs

First point (x₁, y₁).

Second point (x₂, y₂).

Result

Slope (m)

2

The line through (2, 3) and (6, 11) has slope 2 and equation y = 2x − 1.

y-intercept (b)
-1
Equation of the line
y = 2x − 1
Angle with the x-axis
63.4349 °
Slope as a percent grade
200%
Distance between points
8.9443
Midpoint
(4, 7)

See the step-by-step solution ↓

Step-by-step solution

  1. Slope (m) is rise over run: how far the line goes up (change in y) divided by how far it goes across (change in x)

    m=11−36−2=84=2
  2. Find where the line crosses the y-axis (b): start from the first point and undo the slope back to x = 0

    b=3−2×2=−1
  3. Put the slope m and the crossing point b into the line's equation, y = mx + b

    y = 2x − 1
  4. Find the angle the line makes with the x-axis, using the arctangent (the angle whose slope this is)

    θ=arctan(2)=63.434949
  5. Find the distance between the points. The run and rise form the two short sides of a right triangle, so the Pythagorean theorem gives the long side

    d=42+82=80=8.944272
  6. Find the midpoint, halfway between: average the two x values and the two y values

    M=((2 + 6) ÷ 2, (3 + 11) ÷ 2)=(4, 7)

Test yourself

20 quick questions built from this calculator's formula: work out results, predict what happens when an input changes, and work backward from an answer. Every answer comes with the working.

How to solve this on a calculator

The keys to press to get this page's worked-example answer on an ordinary calculator, with what the display should show after each step. A named-model tab follows that calculator's official guidebook.

Plot the line and read its intercept and slope

Problem
The line through (−1, 4) and (3, −2) is y = −1.5x + 2.5. Graph it, check both points, and read off the intercept and slope.
Formula
y = mx + b; b = y at x = 0; m = y(1) − y(0)
Example values
(x₁, y₁) = (−1, 4) (first point); (x₂, y₂) = (3, −2) (second point). These are the fixed values from the worked example on this page, so the keys stay the same whatever you type into the calculator above.
Why a graphing calculator
A graph shows the line really passes through both points, and Value reads exact points off it, so you can see where the intercept and slope come from.
The whole sequence
Y=Y1 = −1.5x+2.5Valuex = −1Valuex = 3Valuex = 0Valuex = 1−2.5=

Step by step

  1. Y=Y1 = −1.5x+2.5

    Press Y= and enter the line from this page's answer, y = −1.5x + 2.5, as Y1.

    Display: Y1=−1.5x+2.5

  2. Valuex = −1

    Value at x = −1 gives 4: the line passes through the first point, (−1, 4).

    Display: x=-1, Y1=4

  3. Valuex = 3

    Value at x = 3 gives −2: it also passes through the second point, (3, −2).

    Display: x=3, Y1=-2

  4. Valuex = 0

    Value at x = 0 gives the y-intercept b, where the line crosses the y-axis.

    Display: x=0, Y1=2.5

  5. Valuex = 1

    Value at x = 1: one step to the right of the intercept. The answer becomes Ans.

    Display: x=1, Y1=1

  6. −2.5=

    On the home screen, − 2.5 = subtracts y at x = 0 from y at x = 1. The change in y over a run of 1 is the slope.

    Display: -1.5

If your answer looks wrong

  • Type the slope with its minus sign: −1.5x + 2.5. Without it the line rises, and Value at x = 3 shows 7 instead of −2.
  • If Value at x = −1 shows 1 instead of 4, you entered 1.5x + 2.5 or −1.5x − 2.5: check both signs.
  • Pressing − right after Value continues from that answer (Ans). If you typed a new number first, the display shows that number minus 2.5 instead.

How this is checked: an automated test presses these keys on this site's graphing calculator, checks every display along the way, and confirms the answer matches the calculator on this page (last checked 2026-10-19). It has not been checked on any particular brand or model, and real calculators label some keys differently.

What this calculator does

Give two points and get the slope of the line through them, its equation, and more. The slope tells you how steep a line is: how far it rises for every step it moves to the right. Two points are enough to fix a straight line. So from two points, you can find its slope, write its equation and measure the gap between them.

Enter the coordinates of both points. The calculator gives the slope and the y-intercept, which is where the line crosses the up-and-down y-axis. It also gives the equation in slope-intercept form (y = mx + b), the straight-line distance, the angle with the x-axis and the midpoint. If both points have the same x value, the line is vertical, and the calculator tells you so.

Where it's used

Why this math matters outside the classroom:

  • Wheelchair ramps. A ramp rising 2 ft over a 24 ft run has a slope of 2/24, the 1:12 maximum in US accessibility guidelines.
  • Road grades. A road that climbs 60 m over 1,000 m of horizontal distance has a slope of 0.06, posted as a 6% grade.
  • Phone plans. A plan costing $35 for 2 GB and $45 for 4 GB rises $5 per GB, so its cost is 5x + 25 dollars.
  • Roof pitch. A roof that rises 6 in for every 12 in across has a slope of 0.5, which roofers call a 6/12 pitch.
  • Map distances. Points at (1, 2) and (7, 10) on a grid map are √(6² + 8²) = 10 units apart, with their midpoint at (4, 6).

Grade level and standards: Grades 8–9; Common Core State Standards for Mathematics 8.F.B.4, 8.EE.B.6, 8.G.B.8. © Copyright 2010. National Governors Association Center for Best Practices and Council of Chief State School Officers. All rights reserved.

How to use it

  1. Enter the first point as x₁ and y₁.
  2. Enter the second point as x₂ and y₂. The order of the points doesn't change the slope or the line.
  3. Read the slope and equation, then the distance, angle and midpoint below.

What the inputs mean

x₁
Coordinates can be negative or decimals. For the angle and distance to make sense, use the same scale on both axes.
x₂
Second point (x₂, y₂).

Formula and method

m = (y₂ − y₁) ÷ (x₂ − x₁)
b = y₁ − m × x₁
y = mx + b
d = √((x₂ − x₁)² + (y₂ − y₁)²)
θ = arctan(m)
midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)

In the formulas, (x₁, y₁) and (x₂, y₂) are your two points. m is the slope, b is the y-intercept, d is the distance and θ (theta) is the angle. Slope is the change in y divided by the change in x. The y-intercept b is where the line crosses the y-axis. You find it by putting one point into y = mx + b and solving for b.

For the distance, the run and rise form the two short sides of a right triangle, and the Pythagorean theorem gives the long side. The angle is measured from the positive x-axis, between −90° and 90°. The percent grade is the slope times 100.

When x₁ = x₂, the run is zero, and you can't divide by zero. A line like that is vertical. Its equation is x = c, where c is a fixed number. It has no y-intercept (unless it's the y-axis itself), and it makes a 90° angle with the x-axis.

Worked example

Find the line through (−1, 4) and (3, −2).

  1. Slope: m = (−2 − 4) ÷ (3 − (−1)) = −6 ÷ 4 = −1.5.
  2. Intercept: b = 4 − (−1.5 × −1) = 4 − 1.5 = 2.5.
  3. Equation: y = −1.5x + 2.5.
  4. Distance: √(4² + (−6)²) = √52 ≈ 7.2111; midpoint ((−1 + 3) ÷ 2, (4 + (−2)) ÷ 2) = (1, 1).

Result: The line is y = −1.5x + 2.5. It falls at an angle of about −56.3099° to the x-axis, and the points are about 7.2111 units apart.

Understanding the result

A positive slope rises from left to right, and a negative slope falls. A slope of 0 is a flat, horizontal line. A slope of 2 means y goes up by 2 for every 1 step in x.

For roads and ramps, slope is often given as a percent grade. A slope of 0.05 is a 5% grade.

Assumptions and limitations

  • The points sit on an ordinary x-y grid (a Cartesian plane), with equal scales on both axes.
  • It only covers straight lines through two points. It doesn't fit a line to more points; that's called linear regression.
  • Decimal slopes are shown as decimals, not as reduced fractions.

Frequently asked questions

Why is the slope of a vertical line undefined rather than infinite?

Working it out means dividing the rise by a run of zero, and dividing by zero has no answer. The line itself is perfectly clear. It's just described by x = c instead of y = mx + b.

Does it matter which point I enter first?

No. Swapping the points flips the sign of both the rise and the run. So their ratio, the slope, stays the same, and so does the equation.

How do I get the slope from an equation instead of points?

If the equation is already in the form y = mx + b, the slope is m. If not, rearrange it so y is on its own first. For 2x + 4y = 8, that gives y = −0.5x + 2, so the slope is −0.5.

What is the slope of a line perpendicular to this one?

A perpendicular line crosses at a right angle. Its slope is −1 ÷ m, which is flipped and has the opposite sign. A line with slope 2 is perpendicular to any line with slope −0.5. Horizontal and vertical lines are perpendicular to each other.

How this calculator is checked

Method: Analytic geometry: two-point slope, slope-intercept form, Euclidean distance and midpoint formulas. The calculation is covered by automated tests with known reference values and edge cases. Last updated 2026-10-18. Found a problem? Tell us.

Embed this calculator

Put this Slope Calculator on your own website or blog for free. Paste this code where you want it to appear: