Calcometry

Slope Calculator

By using our calculators, you agree to our Terms of Use.

Slope and y-intercept of the line through two points: m = (y₂ − y₁) / (x₂ − x₁).

Two points

Slope (m)

2

y-intercept (b): 1

Line equation
y = 2x + 1

Related calculators

Slope between two points

Slope measures how steep a line is — the change in y divided by the change in x between two points: m = (y₂ − y₁) / (x₂ − x₁). A positive slope rises left to right, a negative slope falls, a slope of 0 is a flat horizontal line, and a vertical line has an undefined slope (division by zero).

Once you know the slope, the y-intercept (b) comes from the point-slope relationship: b = y₁ − m·x₁. Together, m and b describe the full line in slope-intercept form, y = mx + b.

Example: for the points (0, 1) and (2, 5), the slope is (5 − 1) / (2 − 0) = 4/2 = 2, and the y-intercept is 1 − 2×0 = 1 — so the line is y = 2x + 1.

Parallel lines share the same slope; perpendicular lines have slopes whose product is −1 (when neither is vertical).

Point-slope form y − y₁ = m(x − x₁) is another way to write the line when you know one point and the slope.

Worked example with defaults (0,1) and (2,5): slope m = (5−1)/(2−0) = 2, intercept b = 1 → equation y = 2x + 1.

Rise-over-run sign matters for drainage and roof pitch — a −4/12 slope drops 4 inches per 12 horizontal inches; construction drawings label pitch as positive rise with direction implied. Roof pitch labels positive rise per twelve run — −4/12 drainage slope drops four inches vertically per foot horizontally in construction drawings. Sketch rise/run arrows on graph paper even when the tool prints m = −4/12 for roof pitch.

Regression slope on scatter plots averages many points — two-point slope from (0,1) and (2,5) is exact for a line through both, not a best-fit line through twenty noisy measurements. Two-point slope through (0,1) and (2,5) is exact — regression on twenty noisy points yields a least-squares slope, not necessarily this value.

Vertical line x=3 has undefined slope — enter two points with same x to see division by zero; horizontal y=5 gives slope 0 with any distinct x pair sharing y=5. Same x on both points → undefined slope — horizontal y=5 across distinct x values gives zero slope, the flat line case. Explain undefined versus zero slope in words when both points share an x or y coordinate.

Common questions

What does an undefined slope mean?

It means the two points share the same x-coordinate, forming a vertical line. Vertical lines have no defined slope because the change in x is zero, which would require dividing by zero.

How do I get the full equation of the line?

Combine the slope (m) and y-intercept (b) shown here into slope-intercept form: y = mx + b.

Can I use this for horizontal lines?

Yes — equal y-values give slope 0. The equation is y = constant. Vertical lines still have undefined slope.