Home › Math & Science › Slope Calculator

Slope Calculator

Our free slope calculator finds the slope of a line from any two points, and it also gives you the y-intercept and the full equation of the line. Just enter the coordinates of your two points and the answer appears instantly, with every step shown so you can check the math yourself.

Enter the coordinates of two different points on the line. Decimals and negative numbers are fine.

Slope = 2
Line equation: y = 2x − 1  •  y-intercept: −1
Change in y (rise)8
Change in x (run)4
Slope (rise ÷ run)2
y-intercept (b)−1

How it works

The slope of a line measures how steep it is. Think of a road climbing a hill in Colorado: a gentle grade rises a little over a long distance, while a steep driveway in San Francisco rises a lot over a short one. Slope turns that idea into a single number — the amount the line goes up or down for each step it moves sideways.

To find the slope, you need two points on the line. Call them (x1, y1) and (x2, y2). The calculator subtracts the y-values to get the rise, subtracts the x-values to get the run, and divides the rise by the run. It does not matter which point you call first, as long as you keep the same order for both coordinates: swapping the points changes the sign of both the rise and the run, so the answer stays the same.

slope (m) = (y2 − y1) ÷ (x2 − x1)   •   y-intercept (b) = y1 − m × x1   •   line equation: y = mx + b

The sign of the slope tells you the direction of the line. A positive slope rises as you move from left to right, a negative slope falls, and a slope of zero means the line is perfectly flat — a horizontal line like the surface of a calm lake. The bigger the absolute value, the steeper the line: a slope of 4 is twice as steep as a slope of 2.

Once the slope is known, the calculator finds the y-intercept, the value of y where the line crosses the vertical axis (where x = 0). Using one of your points, it computes b = y − m × x. Together, the slope and the intercept give the slope-intercept form of the line, y = mx + b, which lets you find the y-value for any x. If both points share the same x-value, the line is vertical, the run is zero, and the slope is undefined — the calculator will tell you that instead of showing a wrong number, and the equation is simply x = that shared value.

Slope shows up far beyond math class. Roofers in Texas describe a roof pitch as rise over run, for example 6 inches of rise for every 12 inches of run, which is a slope of 0.5. Engineers use it for wheelchair ramps, where the Americans with Disabilities Act calls for a gentle slope of about 1 in 12. Hikers read it as grade on a trail map, and economists use it to describe how fast a price or a cost is changing.

Worked example

Suppose a small business in Ohio tracks its monthly profit, and in month 2 it earned $3,000 while in month 6 it earned $11,000. Treating months as x and profit in thousands of dollars as y, the two points are (2, 3) and (6, 11). How fast is profit growing each month?

Step 1 — find the rise: y2 − y1 = 11 − 3 = 8. Step 2 — find the run: x2 − x1 = 6 − 2 = 4. Step 3 — divide: slope = 8 ÷ 4 = 2. So profit grows by $2,000 per month, which matches the slope of 2 in thousands of dollars.

Step 4 — find the y-intercept: b = y1 − m × x1 = 3 − 2 × 2 = 3 − 4 = −1. Step 5 — write the equation: y = 2x − 1. Checking it against the second point: when x = 6, y = 2 × 6 − 1 = 11, exactly as given. Enter (2, 3) and (6, 11) in the calculator above and you get the same result: slope 2, y-intercept −1, line equation y = 2x − 1.

FAQ

What is the slope of a line?

The slope is a number that tells you how steep a line is and which way it tilts. It is the change in y divided by the change in x between two points on the line. A positive slope rises from left to right, a negative slope falls, a slope of zero is a flat horizontal line, and a vertical line has an undefined slope.

How do you find slope from two points?

Subtract the y-values and divide by the difference of the x-values: slope = (y2 − y1) / (x2 − x1). For example, the points (2, 3) and (6, 11) give (11 − 3) / (6 − 2) = 8 / 4 = 2, so the slope is 2.

What does a slope of 2 mean?

A slope of 2 means that for every 1 unit you move to the right along the x-axis, the line rises 2 units on the y-axis. It is a fairly steep upward line. A slope of 1/2, by contrast, would rise only half a unit for each unit to the right.

What is the y-intercept?

The y-intercept is the y-value where the line crosses the vertical y-axis, the point where x equals zero. Once you know the slope m and one point on the line, you can find it with b = y − m*x, and then write the full line as y = mx + b.

Can a slope be undefined?

Yes. When the two points have the same x-value, the line is vertical and the change in x is zero, so the slope formula divides by zero. A vertical line has no slope and its equation is simply x = a, where a is the shared x-value.