Slope Equation Calculator: Find Slope Instantly
- Angle (degrees)
- °
- Result
- Distance
- units
- Result
- X�
- 1
- You entered
This slope equation calculator works out the slope (gradient) of a straight line from two points, (xâ‚�, yâ‚�) and (xâ‚‚, yâ‚‚). You enter the coordinates and the calculator returns the slope as a decimal, a fraction, and the equation of the line in slope-intercept form (y = mx + b). It also gives the angle of inclination in degrees and the line’s distance between the two points.
Formula
The slope of a line measures how steep it is. Given two points on the line, (x�, y�) and (x₂, y₂), the slope m is the change in y divided by the change in x:
m = (y₂ − y�) / (x₂ − x�)
- m = slope (unitless, often written as a fraction or decimal)
- x�, y� = coordinates of the first point
- xâ‚‚, yâ‚‚ = coordinates of the second point
The slope is the same no matter which point you call first, as long as you subtract consistently. The line’s equation in slope-intercept form is y = mx + b, where b is the y-intercept. You can find b by plugging one point into the equation: b = yâ‚� − m·xâ‚�.
Worked Example
Using the default points (1, 2) and (4, 8):
- Find the change in y: y₂ − y� = 8 − 2 = 6
- Find the change in x: x₂ − x� = 4 − 1 = 3
- Divide: m = 6 ÷ 3 = 2.00
- Angle: atand(2) ≈ 63.43°
- Distance: √((4−1)² + (8−2)²) = √(9 + 36) = √45 ≈ 6.71
The calculator gives slope = 2.00, angle = 63.43°, distance = 6.71. The line’s equation is y = 2x + 0 (since b = 2 − 2·1 = 0).
When to Use the Slope Equation
Slope is used in algebra, geometry, physics, economics, and engineering. Common situations:
- Finding the slope of a line from a graph or two data points
- Writing the equation of a line given two points
- Determining if two lines are parallel (equal slopes) or perpendicular (slopes multiply to −1)
- Calculating the grade of a road or ramp (rise over run, often expressed as a percentage)
- Interpreting the rate of change in a linear relationship, like speed (distance vs. time)
The slope is a constant for any straight line. If you have a curve, the slope changes at every point, and you’d need calculus (the derivative) to find the slope at a specific point.
How to Read the Result
A positive slope means the line rises from left to right. A negative slope means it falls. A slope of zero means the line is horizontal (y is constant). An undefined slope (division by zero) means the line is vertical (x is constant).
The angle is the acute angle the line makes with the positive x-axis, measured in degrees. A slope of 1 corresponds to a 45° angle. The distance is the straight-line length between the two points, in the same units as your coordinates.
In the slope-intercept form y = mx + b, the slope m tells you the rate of change: for every 1 unit increase in x, y changes by m units. The intercept b is where the line crosses the y-axis.
Common Mistakes and Pitfalls
- Mixing up x and y: Always subtract y’s in the numerator and x’s in the denominator. Swapping them gives the reciprocal slope, which is wrong.
- Inconsistent order: If you use (x₂ − x�) in the denominator, you must use (y₂ − y�) in the numerator. Mixing (y� − y₂) with (x₂ − x�) flips the sign.
- Dividing by zero: If xâ‚‚ = xâ‚�, the line is vertical and the slope is undefined. The calculator will show an error; in that case, the line’s equation is x = constant.
- Rounding too early: If you round intermediate values, the final slope can be off. Use full precision until the final step.
- Using slope for non-linear data: Two points on a curve give the slope of the secant line, not the curve’s slope at a point.
How to Choose the Right Method
The slope formula is the most direct way when you have two points. But other methods exist:
- From a graph: Pick two clear points on the line, ideally where it crosses grid lines, then use the same formula.
- From an equation: If the line is in slope-intercept form y = mx + b, the slope is m. If it’s in standard form Ax + By = C, solve for y to get m = −A/B.
- From a table: Choose any two rows and apply the formula.
- From a real-world rate: If you know the rise and run directly (like a ramp’s height and length), slope = rise / run.
For most problems, the two-point formula works. If you only have one point and the slope, use the point-slope form: y − y� = m(x − x�).
Limits of the Formula
The slope formula assumes a straight line and Euclidean geometry. It does not apply to curved functions, and it gives no information about the line’s position (you need the intercept for that). The angle output uses the arctangent function, which returns values between −90° and 90°, so a line with slope −2 gives an angle of −63.43°, not 116.57°. Also, the slope is unitless, but if your axes have different units (e.g., time vs. distance), the slope carries those units (e.g., km/h).
For vertical lines, the slope is undefined, and the angle is 90° (or −90°). The calculator cannot compute a numeric slope for such cases, but the distance formula still works.
Frequently Asked Questions
What if the slope is a fraction?
The calculator gives a decimal, but you can convert it to a fraction. For example, slope 0.5 means 1/2. In algebra, leaving it as a fraction is often preferred because it shows rise over run exactly.
How do I find the y-intercept from two points?
After calculating the slope m, plug one point into y = mx + b and solve for b. For instance, with point (1, 2) and m = 2, you get b = 2 − 2·1 = 0. Then the equation is y = 2x.
What does a slope of 0 mean?
A slope of 0 means the line is horizontal. All points on the line have the same y-coordinate, so the equation is y = constant. The angle is 0°.
Can I use negative coordinates?
Yes. The formula works with negative numbers. For example, points (−2, 3) and (1, −1) give slope (−1 − 3) / (1 − (−2)) = −4/3 ≈ −1.33.
Why is the slope undefined for a vertical line?
Because the change in x is zero, and division by zero is not defined. A vertical line has an infinite slope, and its equation is x = constant.
How does slope relate to the angle of a line?
The slope is the tangent of the angle: m = tan(θ). So θ = arctan(m). A slope of 1 gives a 45° angle. The calculator provides this angle automatically.
Related
Formula used
in x1 | X� | - | 1 | 0 in y1 | Y� | - | 2 | 0 in x2 | X₂ | - | 4 | 0 in y2 | Y₂ | - | 8 | 0 out slope | Slope (m) | - | (y2 - y1) / (x2 - x1) | 2 out angle | Angle (degrees) | ° | atand((y2 - y1) / (x2 - x1)) | 2 out dist | Distance | units | sqrt((x2 - x1)^2 + (y2 - y1)^2) | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.