Free Slope Calculator
Find the slope of a line through two points, plus its y-intercept, full equation y = mx + b, and the angle it makes with the x-axis.
Enter two points to find the slope, intercept, equation, and angle.
m = (yβ β yβ) / (xβ β xβ), b = yβ β mΒ·xβ, and ΞΈ = arctan(m). When xβ = xβ the line is vertical and the slope is undefined.
Quick answer
The slope between two points is m = (y2 β y1) / (x2 β x1) β the change in y divided by the change in x. For example, through (1, 2) and (4, 8), m = (8 β 2) / (4 β 1) = 6 / 3 = 2, so the line rises 2 units for every 1 unit right. The y-intercept is b = y1 β mΒ·x1 = 2 β 2Β·1 = 0, giving the equation y = 2x.
Formula & method
Slope
m = (yβ β yβ) / (xβ β xβ)
- m β slope of the line
- (xβ, yβ) β coordinates of the first point
- (xβ, yβ) β coordinates of the second point
Rise over run: vertical change divided by horizontal change. Undefined when xβ = xβ (a vertical line).
Y-intercept
b = yβ β m Β· xβ
The y-value where the line crosses the y-axis (x = 0). Either point can be substituted; both give the same b.
Line equation
y = mΒ·x + b
Slope-intercept form. Combine the computed m and b to describe the full line.
Angle of inclination
ΞΈ = arctan(m), in degrees
The angle the line makes with the positive x-axis. Positive slope gives 0Β°β90Β°, negative slope gives β90Β°β0Β°.
Examples
- Input
- x1 = 1, y1 = 2, x2 = 4, y2 = 8
- Result
- m = 2, b = 0, y = 2x, angle β 63.4349Β°
- Why
- m = (8 β 2) / (4 β 1) = 6 / 3 = 2. b = 2 β 2Β·1 = 0, so y = 2x. The angle is arctan(2) β 63.4349Β°.
- Input
- x1 = β3, y1 = 4, x2 = 2, y2 = β1
- Result
- m = β1, b = 1, y = βx + 1, angle = β45Β°
- Why
- m = (β1 β 4) / (2 β (β3)) = β5 / 5 = β1. b = 4 β (β1)Β·(β3) = 4 β 3 = 1, so y = βx + 1. arctan(β1) = β45Β°.
- Input
- x1 = 0, y1 = 3, x2 = 5, y2 = 3
- Result
- m = 0, b = 3, y = 3, angle = 0Β°
- Why
- m = (3 β 3) / (5 β 0) = 0 / 5 = 0. A zero slope is a flat line: b = 3 β 0Β·0 = 3, so y = 3, with angle arctan(0) = 0Β°.
- Input
- x1 = 2, y1 = 5, x2 = 2, y2 = 9
- Result
- Slope undefined (vertical line x = 2)
- Why
- Here x2 = x1 = 2, so the run (x2 β x1) = 0 and dividing by zero is undefined. The line is vertical, written x = 2, and has no finite slope or y-intercept.
When to use this tool
- Finding how steep a line, ramp, road, or roof is from two known points or measurements.
- Writing the slope-intercept equation y = mx + b of a line for algebra, graphing, or geometry homework.
- Computing the rate of change between two data points (e.g. how fast a quantity rises per unit of time).
- Checking whether two lines are parallel (equal slopes) or perpendicular (slopes whose product is β1).
Common mistakes
- Subtracting the coordinates in a different order top and bottom β e.g. using (y2 β y1) over (x1 β x2). Keep both differences in the same direction or you flip the sign of the slope.
- Putting x in the numerator. Slope is rise over run: the change in y goes on top, the change in x on the bottom.
- Forgetting that a vertical line (x2 = x1) has an undefined slope, not a slope of 0. A slope of 0 is a horizontal line.
- Mishandling negative coordinates β subtracting a negative is the same as adding, so x2 β (β3) = x2 + 3. Dropping the double-negative gives the wrong run.
Frequently asked questions
What is the formula for slope between two points?
Slope is m = (y2 β y1) / (x2 β x1), the change in y divided by the change in x. This is often remembered as 'rise over run.' For (1, 2) and (4, 8) it gives (8 β 2) / (4 β 1) = 2.
What does a slope of 0 mean?
A slope of 0 means the line is perfectly horizontal β y stays the same no matter how x changes, because the rise (y2 β y1) is zero. Its equation is simply y = b. This is different from an undefined slope, which is a vertical line.
Why is the slope of a vertical line undefined?
For a vertical line, both points share the same x-value, so the run x2 β x1 equals 0. Division by zero is undefined, so the slope has no number. The line is written as x = constant instead of y = mx + b.
How do I find the y-intercept once I have the slope?
Plug one point and the slope into b = y β mΒ·x. Using (1, 2) with m = 2 gives b = 2 β 2Β·1 = 0. You can use either point β both yield the same intercept β and then write the line as y = mx + b.
How do I convert a slope into an angle?
Take the inverse tangent of the slope: angle = arctan(m), then convert to degrees. A slope of 1 is 45Β°, a slope of 2 is about 63.43Β°, and a slope of 0 is 0Β°. Negative slopes give negative angles (going downhill left-to-right).
What does a negative slope tell me?
A negative slope means the line falls as you move from left to right: y decreases while x increases. For example, a slope of β1 drops one unit down for every unit right and makes a β45Β° angle with the x-axis.
Sources & references
External references open in a new tab. We are independent and not affiliated with these organizations.
- β Free to use
- β No sign-up required
- β Runs entirely in your browser β nothing is uploaded.
- β Formula and method shown above
Provided βas isβ for general information only β results may be inaccurate, so verify before you rely on them. No warranty; use at your own risk.
Built and reviewed by HIFreeTools against the formula shown above and any authoritative references cited on this page. See our methodology and editorial standards.
Related tools
- Distance Between Two Points CalculatorCalculators
- Pythagorean Theorem CalculatorCalculators
- Quadratic Formula CalculatorCalculators
- Percentage CalculatorCalculators
- Triangle Area CalculatorCalculators
Embed this tool on your site
Free to embed, no sign-up. Paste this code where you want the slope calculator to appear: