A slope calculator that shows the line equation and a graph
This slope calculator takes two points and returns the slope of the line through them, its y-intercept and its equation in slope-intercept, point-slope and standard form, together with the angle, the distance between the points and the midpoint. The slope is calculated as an exact fraction as well as a decimal, so 3/4 does not become 0.75 behind your back.
It is aimed at algebra and coordinate-geometry students, teachers preparing examples, and anyone who needs the equation of a straight line fast. A small graph draws the line and both points.
How to use the Slope Calculator (Two Points, Slope-Intercept)
- Enter the x and y coordinates of Point A and Point B. Negative numbers and decimals are fine.
- Read the slope m in the result box, as a fraction and a decimal.
- Copy the line equation you need: slope-intercept (y = mx + b), point-slope or standard form.
- Check the y-intercept, x-intercept, angle, distance and midpoint underneath.
- Look at the graph to confirm that the line passes through both points.
Slope Calculator (Two Points, Slope-Intercept) features
Exact fractions
Slope and intercepts are reduced fractions with the decimal value alongside.
Three equation forms
Slope-intercept, point-slope and standard form with integer coefficients.
Special lines
Horizontal lines (slope 0) and vertical lines (slope undefined, x = c) are handled explicitly.
Graph and extras
Angle with the x-axis, distance, midpoint and both intercepts.
The slope formula
The slope is the change in y divided by the change in x, often remembered as “rise over run”: m = (y₂ − y₁) ÷ (x₂ − x₁). It does not matter which point you call A or B as long as you subtract in the same order on top and bottom.
Worked example: through (1, 2) and (5, 5), the rise is 5 − 2 = 3 and the run is 5 − 1 = 4, so m = 3/4 = 0.75. The y-intercept is b = y₁ − m·x₁ = 2 − (3/4)(1) = 5/4, so the line is y = (3/4)x + 5/4.
Equation forms
| Form | Pattern | Example |
|---|---|---|
| Slope-intercept | y = mx + b | y = (3/4)x + 5/4 |
| Point-slope | y − y₁ = m(x − x₁) | y − 2 = (3/4)(x − 1) |
| Standard | Ax + By = C | 3x − 4y = −5 |
Reading the sign and size of the slope
- Positive slope: the line rises from left to right. Negative slope: it falls.
- Zero slope: a horizontal line, y = constant.
- Undefined slope: a vertical line, x = constant, because the run is 0 and division by zero is not allowed.
- Larger absolute values mean steeper lines; the angle with the x-axis is arctan(m).
- Parallel lines have equal slopes; perpendicular lines have slopes whose product is −1.
Worked example with negative numbers
Take A(−2, 3) and B(4, −6). The rise is −6 − 3 = −9 and the run is 4 − (−2) = 6, so m = −9/6 = −3/2 = −1.5: the line falls as you move right. The y-intercept is b = 3 − (−3/2)(−2) = 3 − 3 = 0, so the line is y = (−3/2)x and passes through the origin. Swapping the points gives (3 − (−6)) ÷ (−2 − 4) = 9 ÷ −6, the same slope, which is a quick way to check your arithmetic.
Related tools
To plot more than one line use the function grapher, to fit a line to many points use the linear regression calculator, and to solve for where lines meet try the equation solver. For construction grades (percent, degrees, 1:12), see the ramp and drain slope calculator.
Slope Calculator (Two Points, Slope-Intercept) FAQ
What is the slope formula?
m = (y₂ − y₁) ÷ (x₂ − x₁): the difference in y divided by the difference in x between two points on the line.
How do I find the slope-intercept form of a line?
Find m with the slope formula, then b = y₁ − m·x₁, and write y = mx + b. This tool does both steps and shows the result.
What if the two x values are equal?
The line is vertical and its slope is undefined. The equation is x = that value.
What does a slope of 0 mean?
The line is horizontal: y does not change as x changes.
Can I use decimals and negative numbers?
Yes, up to 6 decimal places; the arithmetic is done exactly with whole numbers, so fractions are reduced correctly.
How is this different from a roof or ramp slope calculator?
This one is coordinate geometry. Roof and ramp tools express slope as a percentage, degrees or ratio like 1:12; the angle shown here is arctan(m).