Skip to content
BestCalculators LogoBestCalculators
Free online calculators and converters

Math & Statistics

Slope Calculator: Gradient, Angle and the Line Through Two Points

Find the slope between two points as a fraction, a percentage and an angle, with the line equation, the distance and the midpoint.

Slope, m

1.5

Rise of 9 over a run of 6. Positive climbs left to right, negative falls, and zero is level. If the run is 0 the line is vertical and the slope is undefined, not zero.

Rise, y₂ − y₁
9

The vertical change. Order matters only in that both differences must be taken the same way round; swap both and the slope is unchanged.

Run, x₂ − x₁
6

The horizontal change. A run of zero is the vertical line, the one case where there is no slope to report.

Slope as a percentage
150.00%

How a road sign, a drainage spec and a ramp code all state it. A 100% grade is 45°, which surprises most people — the percentage is not a share of anything.

Angle from horizontal
56.31°

The arctangent of the slope. This is the number a digital level shows and the one a protractor can check.

y-intercept, b
0

Where the line crosses the y-axis, so the equation is y = 1.5x + 0 in slope-intercept form.

x-intercept
0

Where it crosses the x-axis, which is −b ÷ m. A horizontal line never does, and nothing is shown for it.

Distance between the points
10.8167

Pythagoras on the rise and the run. This is the length of the line segment itself — the sloping distance, not the run.

Midpoint, x
5
Midpoint, y
7.5

The average of each coordinate. The midpoint is on the line whatever the slope is, including the vertical case.

Slope of a perpendicular line
-0.666667

The negative reciprocal, −1 ÷ m. Two lines are perpendicular exactly when their slopes multiply to −1.

Run for a rise of 1
0.667

The slope upside down, which is how ramps and drains are specified — 1 in 12 for a wheelchair ramp is this number, not the percentage.

Rise per 12 units of run
18

The twelfths a builder uses for a roof: a 4/12 pitch is a slope of one third. The same line, stated the way a framing square reads it.

How to use this calculator

  1. Enter the coordinates of your first point into the x₁ — first point across and y₁ — first point up input fields.
  2. Enter the coordinates of your second point into the x₂ — second point across and y₂ — second point up input fields.
  3. Review the headline slope result, presented as m, alongside the rise and run values.
  4. Check the generated line equation, distance, midpoint, and angle measurements provided in the output summary.

Understanding Rise Over Run and the Basics of Slope

Finding the steepness of a line is a foundational task in both geometry and construction, and a reliable slope calculator makes this computation instantaneous. When working on a coordinate plane, the fundamental concept governing any straight line is rise over run. The rise represents the vertical change between two distinct locations, while the run denotes the horizontal distance separating them. Dividing the vertical rise by the horizontal run yields the numeric value known as the gradient or slope, frequently denoted by the letter m. Whether you are drafting architectural blueprints, mapping hiking trails, or calculating the pitch of a roof, knowing how to find the slope between two points ensures that structural angles remain true and mathematically sound.

The underlying mathematics rely on coordinate geometry. Given a first coordinate point represented as (x₁, y₁) and a second point as (x₂, y₂), the mathematical formula computes the difference in the vertical coordinates divided by the difference in the horizontal coordinates. Specifically, the vertical change is calculated as y₂ minus y₁, and the horizontal change is found by subtracting x₁ from x₂. The resulting quotient can be positive, negative, zero, or undefined. A positive value indicates that the line rises as it moves from left to right, whereas a negative value indicates a downward descent. A horizontal line has a zero slope because the vertical change is zero, while a vertical line possesses an undefined slope due to a horizontal run of zero.

Interpreting Line Equations, Percentages, and Angles

Beyond a simple fraction, determining the steepness of a line opens up several other vital geometric properties. Once the value of m is established, expressing it as a slope to angle measurement transforms the abstract number into a physical degree of rotation relative to the horizontal axis. This conversion utilizes the arctangent function, rendering an angle that civil engineers and carpenters use to verify structural alignment. Similarly, converting the fraction into a percentage grade is standard practice in civil engineering and road design, where a five percent grade means the road rises five vertical units for every one hundred horizontal units traversed.

Furthermore, a comprehensive mathematical analysis goes beyond the immediate gradient to define the entire trajectory. By applying the calculated m value back into coordinate formulas, you can easily derive the slope intercept form, conventionally written as y = mx + b, where b represents the y-intercept. This linear equation allows you to predict every other coordinate point that falls along the exact same path. Along with the intercept, calculating the straight-line distance using the Pythagorean theorem and finding the precise midpoint between your coordinate pair completes the geometric profile of the line segment.

What a Slope Calculator Assumes About Your Coordinates

Any automated slope calculator operates under strict geometric assumptions that must align with your real-world application. The primary assumption is that the path connecting your two points is perfectly straight and continuous. In physical reality, terrain features, asphalt settling, and structural sagging introduce curvature and irregularities that a simple two-point coordinate formula cannot capture. If you are measuring a winding mountain road or a sagging suspension cable, treating two endpoints as a single linear trajectory will yield an average gradient that hides significant local variations.

Another critical assumption is coordinate accuracy. A tiny measurement error of just a few millimeters in field surveying can drastically alter the final gradient, especially if the horizontal run is very short. When working on precision engineering projects, always verify your initial survey markers before relying on derived outputs like perpendicular line slopes or exact x-intercepts. For critical structural loads, consult a licensed professional engineer rather than relying solely on elementary coordinate geometry.

Reference Table of Common Gradients and Angles

To help contextualize your numerical results, the reference table below illustrates how different fractions, percentages, and degrees relate to one another in everyday applications ranging from wheelchair ramps to steep mountain passes.

Fraction (Rise / Run)Percentage GradeAngle (Degrees)Typical Application
1 / 128.33%4.76°Standard ADA wheelchair ramp maximum
1 / 812.5%7.13°Steep residential driveway limit
1 / 425.0%14.04°Standard asphalt roof pitch (4-in-12)
1 / 250.0%26.57°Very steep embankment or hill
1 / 1100.0%45.00°Equal rise and run diagonal

Examining these figures clarifies why percentage grades and degrees are not interchangeable. While a 100 percent grade represents a rise equal to the run, it corresponds to a 45-degree angle rather than a 90-degree vertical wall. Keeping these standard thresholds in mind prevents costly design errors in construction and landscaping.

The formula

m = (y₂ − y₁) ÷ (x₂ − x₁), the rise over the runy = mx + b, with b = y₁ − m·x₁angle = arctan(m), and percentage grade = m × 100distance = √((x₂ − x₁)² + (y₂ − y₁)²)

Frequently asked questions

What is the difference between slope and gradient?

In mathematical contexts, slope and gradient are generally used interchangeably to describe the steepness of a line. However, in civil engineering and geography, gradient is often expressed as a percentage or a ratio, whereas slope in algebra typically refers to the fractional rise over run or the coefficient m in a linear equation.

How do I calculate slope if my run is zero?

When the horizontal run is zero, meaning x₁ and x₂ are identical, the calculation involves dividing by zero. In mathematics, division by zero is undefined, which means the line is completely vertical and possesses an infinite or undefined slope.

Can a slope value be negative?

Yes, a negative slope simply indicates that the line falls as it moves from left to right across the coordinate plane. This happens when the second y-coordinate is lower than the first y-coordinate, resulting in a negative numerator during the rise-over-run division.

How do I convert a slope fraction into a percentage?

To convert any fractional gradient into a percentage, divide the rise by the run to get a decimal number and then multiply that result by 100. For example, a rise of 2 over a run of 4 gives 0.5, which equals a 50 percent grade.

What is the relationship between parallel and perpendicular lines?

Parallel lines always share the exact same slope value because they rise and run at identical rates. Conversely, perpendicular lines intersect at a 90-degree right angle, and their slopes are negative reciprocals of one another, meaning you flip the fraction and change its sign.

Sources

Last reviewed . Results are for general guidance and are not professional advice.