Slope Calculator

Enter two points and click Calculate.

Line Input
Results

Enter two points and click Calculate.

How Does the Formula Work?

Slope is the single number that answers one question about a straight line: how much does it climb for every step you take sideways? Write the two points as (x₁, y₁) and (x₂, y₂), take the vertical change on top and the horizontal change underneath, and the fraction you get is the slope, almost always called m. Teachers shorten it to rise over run, and that phrase is worth keeping because it tells you what to measure before it tells you what to divide. This calculator takes either two points or a single point paired with a slope you already know, then returns the slope itself, the angle of inclination, the grade as a percentage, where the line cuts both axes, the straight line distance between your points, and the same line written three different ways.

Slope: m = (y₂ − y₁) / (x₂ − x₁) = rise / run
Angle: m = tan(a), so a = arctan(m), reported in [0°, 180°)
Grade: percent = m × 100
y-intercept: b = y₁ − m × x₁
x-intercept: x = −b / m
Distance: d = √((x₂ − x₁)² + (y₂ − y₁)²)
Example: (2, 3) and (7, −9) give m = −12/5 = −2.4, b = 7.8, d = 13

Reading the sign and the size

Two pieces of information hide inside one number. The sign tells you the direction. A positive slope climbs from left to right, a negative slope falls, and a slope of exactly zero is a flat horizontal line that never gains height. The size tells you the steepness, and it is worth building an intuition for a few landmarks. A slope of 1 rises one unit for every unit across, which is a tidy 45 degrees. A slope of 0.5 is half as steep and sits near 26.57 degrees. A slope of 5 is already steep at roughly 78.69 degrees. Notice how quickly the angle stops changing once the slope gets large: going from a slope of 5 to a slope of 50 only moves the angle from about 78.69 to about 88.85 degrees, because the line is running out of room before it reaches vertical.

The vertical line problem

Every other case behaves, and then there is the vertical line. Take the points (3, 1) and (3, 7). The rise is 6 and the run is 0, so the formula wants you to divide 6 by 0, and division by zero has no answer. This is why the calculator prints undefined instead of quietly returning an enormous number. Nothing is wrong with the line itself. It has a perfectly good equation, x = 3, and a perfectly good angle of 90 degrees. What it does not have is a y-intercept, because a line parallel to the y axis never crosses it, unless the line happens to be the y axis, in which case every point on it qualifies. The calculator distinguishes those two situations rather than lumping them together, and it does the mirror image for horizontal lines and the x axis.

Grade, pitch and the 45 degree trap

Outside a maths lesson the same idea travels under different names. Road signs state a grade as a percentage, which is nothing more than the slope multiplied by 100. A road that climbs 6 metres over 100 metres of horizontal distance has a slope of 0.06 and a 6 percent grade. Roofers prefer a ratio of rise to run written against a fixed run of 12, so a roof described as 4 in 12 has a slope of 4 divided by 12, about 0.333, and an angle near 18.43 degrees. Access ramps are often quoted as 1 in 12, a slope of about 0.083 and an angle near 4.76 degrees. The trap that catches people is assuming 100 percent means vertical. It does not. A 100 percent grade is a slope of 1, which is 45 degrees, and a vertical wall has no percentage at all because its slope is undefined.

Three ways to write the same line

Slope intercept form, y = mx + b, is the version most people memorise, and it is the easiest to sketch because you can drop a dot on the y axis at b and then count the slope from there. Point slope form, y − y₁ = m(x − x₁), is the one to reach for when a problem hands you one point and a steepness rather than the crossing point. Standard form, Ax + By = C, looks the least friendly but earns its place twice over: it keeps whole number coefficients where the others produce awkward fractions, and it is the only one of the three that can express a vertical line. Our calculator derives the standard form straight from the differences rather than rebuilding it from a rounded decimal, so integer inputs give integer coefficients, reduced by their common factor, with the leading term kept positive.

Where the distance figure comes from

When you enter two points the calculator also reports how far apart they are, which is the Pythagorean theorem wearing a different hat. The horizontal gap and the vertical gap form the two short sides of a right triangle, and the direct line between your points is the hypotenuse. Square each gap, add them, take the square root. For (2, 3) and (7, −9) the gaps are 5 and −12, and since squaring removes the sign you get 25 plus 144, which is 169, whose square root is exactly 13. Slope and distance answer different questions about the same pair of points: slope is about direction and steepness and ignores how far you travelled, while distance is about length and ignores which way the line tilts.

Work through one example by hand before you lean on any calculator, because the arithmetic is short enough to check and the habit catches sign errors early. Subtract in the same order top and bottom, keep the minus signs, and sanity check the answer against the picture in your head: if the second point sits lower than the first, the slope must come out negative.

Enter your two points above and the full description of the line appears at once, from the raw ratio to the three standard ways of writing it down.

Tips & Recommendations

Keep the order

Whichever point you call first, use it first on the top and the bottom. Swapping one but not the other flips the sign.

Zero is a real value

A coordinate of 0 is data, not a blank. Leave a field empty and the calculator asks for it instead of guessing zero.

Undefined is an answer

Matching x values mean a vertical line. Its slope is undefined, but its equation, x = a constant, still works.

100 percent is 45 degrees

A 100 percent grade is a slope of 1, not a cliff. Doubling a grade never doubles the angle.

Frequently Asked Questions

How do you find the slope from two points?

Subtract the two y values, subtract the two x values in the same order, then divide. For (2, 3) and (7, -9) the rise is -9 minus 3, or -12, and the run is 7 minus 2, or 5. The slope is -12 divided by 5, which is -2.4. Order does not matter as long as you keep it consistent on both the top and the bottom of the fraction.

Why is the slope of a vertical line undefined?

A vertical line has two points with the same x value, so the run is zero and the formula asks you to divide by zero. That has no answer, which is why the calculator reports the slope as undefined rather than printing a huge number. The line is still perfectly real and still has an equation: it is written x equals a constant, such as x = 3, and its angle of inclination is exactly 90 degrees.

What does a negative slope tell you?

It means the line falls as you read it from left to right. Every step to the right drops the y value. A slope of -2.4 says that moving one unit right pushes the line down 2.4 units. Positive slopes climb, a slope of zero is a flat horizontal line, and the steeper the number in either direction, the closer the line gets to vertical.

How do I turn a slope into a percentage grade?

Multiply it by 100. Road signs and roof plans use this form because it reads faster than a decimal. A slope of 0.06 is a 6 percent grade, which means the surface rises 6 metres over every 100 metres of horizontal distance. Note that a 100 percent grade is not vertical: it is a slope of 1, which climbs at 45 degrees.

Is the angle the same thing as the slope?

No, though they describe the same steepness. The slope is a ratio of rise to run, while the angle of inclination is measured in degrees from the positive x axis. They are linked by the tangent function, so the slope equals the tangent of the angle. A slope of 1 gives 45 degrees, a slope of 0 gives 0 degrees, and a vertical line gives 90 degrees.

What are the three forms of a line equation?

Slope intercept form, y = mx + b, is the quickest to read because the slope and the crossing point sit right there. Point slope form, y - y1 = m(x - x1), is what you reach for when you know a point and the steepness. Standard form, Ax + By = C, keeps whole number coefficients and handles vertical lines that the other two cannot express.

Recent Calculations

No calculations yet

Last updated: September 21, 2026 Reviewed by: MathGyro Editorial Team