Slope Calculator
Slope1.5000
Equationy = 1.5000x + 0.0000
Y-Intercept0.0000
Distance7.2111
Angle56.31deg
The slope of a line measures how steeply it rises or falls — the change in y divided by the change in x between two points, often called rise over run. From two coordinates this calculator finds the slope, the slope-intercept equation, the distance between the points, and the angle of inclination, handling vertical lines as a special undefined case.
Formula
m = (y2 − y1) / (x2 − x1) ; b = y1 − m·x1 ; angle = |atan(m)| in degrees
- m
- Slope (rise over run); undefined when x1 = x2
- b
- Y-intercept, where the line crosses the y-axis
- (x1, y1)
- Coordinates of the first point
- (x2, y2)
- Coordinates of the second point
How it works
- Enter the coordinates of two points, (x1, y1) and (x2, y2).
- The slope m is computed as (y2 − y1) / (x2 − x1). The y-intercept b comes from b = y1 − m·x1, giving the line equation y = m·x + b.
- The calculator also returns the straight-line distance between the points and the inclination angle as the absolute value of arctan(m) in degrees. If x1 equals x2 the line is vertical: the slope is undefined, the equation becomes x = x1, and the angle is 90°.
Worked examples
Find the slope and equation of the line through (1, 2) and (4, 8).
- Slope m = (8 − 2) / (4 − 1) = 6 / 3 = 2.
- Y-intercept b = 2 − 2 × 1 = 0.
- Inclination angle = |atan(2)| ≈ 63.43°; distance = √(3² + 6²) = √45 ≈ 6.708.
Slope = 2, equation y = 2.0000x + 0.0000, angle ≈ 63.43°
Find the slope of the vertical line through (3, 1) and (3, 7).
- Both x-values are 3, so x2 − x1 = 0 and the slope cannot be computed.
- The calculator reports the slope as undefined.
- The line is written x = 3 with a 90° angle of inclination.
Slope undefined (vertical line), equation x = 3, angle 90°
Frequently asked questions
- What does a slope of zero versus an undefined slope mean?
- A slope of zero is a perfectly horizontal line (y never changes). An undefined slope is a perfectly vertical line, which happens when both points share the same x-value, so the run is zero and you cannot divide by it.
- How is the angle of inclination calculated?
- The calculator takes the arctangent of the slope and converts it to degrees, then reports its absolute value, so both upward and downward lines give a positive angle between 0° and 90°. A vertical line is fixed at 90°.
- What is slope-intercept form?
- Slope-intercept form is y = mx + b, where m is the slope and b is the y-intercept. Once the slope is known, the calculator substitutes one point to solve for b and assembles the full equation for you.
- Does the order of the two points matter?
- No. Subtracting the coordinates in either order gives the same slope because both the numerator and denominator flip sign together. The distance between the points is also unaffected by their order.