Slope Calculator
Enter two points to find the slope between them and the equation of the line that passes through both.
Run length accepts a decimal or a fraction such as 25/3. Minimum lengths are displayed exactly, so copying them does not cross a slope-class boundary through rounding.
For non-restricted pedestrian ramps in Spain. These results assess longitudinal slope and horizontal run length; a complete design also considers width, cross slope, landings and handrails. Thresholds apply to each run.
DB-SUA 1 §4.3.1–4.3.2 · 14.06.2022 / 15.07.2024 · DB-SUA · DB-SUA C
Check the active inputs and the formula domain. Blank, malformed or out-of-range values clear every result.
m = Δy/Δx; p = 100m; θ = atan(m); m = tan(θ); −90° < θ < 90°. h(cm)/100; L(m).
Approximate results show up to 12 significant digits. Decimal fields use a dot, up to 12 digits on each side, an exponent from −24 to 24 and absolute values up to 10¹². Rational intermediate numerators and denominators are limited to 512 bits. Integer and scientific-notation exceptions are specified below. m=(y₂−y₁)/(x₂−x₁); y=mx+b; x₁=x₂ ∧ y₁≠y₂ ⇒ x=x₁; (x₁,y₁)≠(x₂,y₂).
How slope and the line equation are calculated
Slope (m) measures how steep a line is — the ratio of vertical change to horizontal change between two points: m = (y2−y1) / (x2−x1). A positive slope rises left to right, a negative slope falls, and a slope of 0 is a horizontal line.
Once you know the slope, the full line equation in slope-intercept form (y = mx + b) follows by solving for the y-intercept: b = y1 − m×x1, using either of the original points.
Frequently asked questions
Why is a vertical line's slope undefined?
Slope is rise divided by run; a vertical line has zero horizontal change (run = 0), and division by zero is undefined — vertical lines are instead described by an equation like x = 3.
What does a slope of 0 mean?
A slope of 0 means the line is perfectly horizontal — there's no vertical change as x increases.
Does it matter which point I label as point 1?
No — swapping the two points flips the sign of both the rise and the run, so the ratio (the slope) comes out exactly the same.
How we verified this calculator
The calculator is checked against 3 reference cases computed independently of its code. Last passed: .
| # | Inputs | Expected result |
|---|---|---|
| 1 |
Mode = Percent to degrees
Slope (%) = -100
Rise (cm) =
|
Angle (degrees): -45
Ratio 1:n: 1
Angle (radians): -0.785398163397
Slope (%): -100
|
| 2 |
Mode = Degrees to percent
Angle (degrees) = 45
|
Slope (%): 100
Angle (degrees): 45
Ratio 1:n: 1
|
| 3 |
Mode = Degrees to percent
Angle (degrees) = -45
|
Slope (%): -100
Angle (degrees): -45
|