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
- Enter the first point as x₁ and y₁.
- Enter the second point as x₂ and y₂. The order of the points doesn't change the slope or the line.
- 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).
- Slope: m = (−2 − 4) ÷ (3 − (−1)) = −6 ÷ 4 = −1.5.
- Intercept: b = 4 − (−1.5 × −1) = 4 − 1.5 = 2.5.
- Equation: y = −1.5x + 2.5.
- 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: