CalcCafe

Slope Calculator

Enter two points and instantly get the slope, y-intercept, full line equation, distance, and angle.

Reviewed by the CalcCafe editorial team · Last updated 1 July 2026 · How we test our tools

Slope (m)
2
Equation
-
y-intercept (b)
-
Distance
-
Angle
-
Δx
-
Δy
-

A vertical line (x₁ = x₂) has an undefined slope and no y-intercept.

Example

For points (1, 2) and (4, 8):

m = (8 - 2) / (4 - 1) = 6 / 3 = 2
b = 2 - 2*1 = 0
Equation: y = 2x + 0
Distance = sqrt(3^2 + 6^2) = 6.708204
Angle = atan2(6, 3) = 63.434949 degrees

How it works

Slope m = (y2 - y1) / (x2 - x1); intercept b = y1 - m*x1; distance = sqrt(dx^2 + dy^2); angle = atan2(dy, dx) in degrees. Vertical lines (x1 = x2) report an undefined slope.

Good to know

The Slope Calculator turns two points on a coordinate plane, (x₁,y₁) and (x₂,y₂), into the full picture of the straight line that connects them. Alongside the slope it returns the y-intercept, the line equation in y = mx + b form, the straight-line distance between the points, the angle of the line, and the raw Δx and Δy. It's aimed at algebra and geometry students, but it's just as handy for anyone working with grades, ramps, roof pitches, or trend lines who already has two coordinates in hand.

Reach for it when you have two data points and need to describe the relationship between them: checking homework, sketching a graph, finding where a line crosses the y-axis, or measuring how steep a path is. Because it recalculates the moment you change any field, you can also use it to explore how moving one point changes steepness and direction without retyping anything.

To read the result, treat the slope as rise over run: a value of 2 means the line climbs 2 units up for every 1 unit right, while a negative slope means it falls left-to-right. The angle complements this, telling you the same steepness in degrees relative to the horizontal, where positive values point up and negative values point down. Distance, by contrast, ignores direction entirely and gives the actual length of the segment between your two points.

One practical caveat: the order of your points does not change the slope, distance, or line, but it does flip the sign of the angle, Δx, and Δy, so be consistent if you care about direction. Watch for the special cases too — if both points are identical you get a single point with no slope, and if the two x-values match you have a vertical line, which has an undefined slope and is written as x = constant rather than y = mx + b.

Frequently asked questions

What happens with a vertical line?
When x1 equals x2 the run is zero, so the slope is undefined (division by zero). The tool reports the slope as 'undefined' and shows the line as x = constant instead of y = mx + b.
How is the angle calculated?
It is the angle of the line relative to the positive x-axis, computed as atan2(y2 - y1, x2 - x1) converted to degrees. It ranges from -180 to 180 degrees, so downward lines give negative angles.
Is my data uploaded anywhere?
No — this calculator runs entirely in your browser; nothing is uploaded.
Is it free?
Yes, completely free with no sign-up and no limits.

People also ask

How do you find the slope between two points?
Subtract the y-values and divide by the difference of the x-values: slope m = (y2 - y1) / (x2 - x1). For example, the points (1, 2) and (4, 8) give m = (8 - 2) / (4 - 1) = 6 / 3 = 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. This happens whenever the two points share the same y-value.
What is the difference between slope and angle?
Slope expresses steepness as a ratio of vertical change to horizontal change (rise over run), while the angle expresses that same steepness in degrees relative to the horizontal axis. A slope of 1 corresponds to a 45-degree angle.
How do you convert a slope to a percentage grade?
Multiply the slope by 100 to get the grade as a percent. A slope of 0.05 is a 5% grade, meaning the line rises 5 units for every 100 units of horizontal distance.
What does a negative slope tell you?
A negative slope means the line goes downward as you move from left to right, so y decreases while x increases. The steeper the descent, the more negative the value.
How do you find the y-intercept from two points?
First find the slope m, then plug one point into b = y - m*x. For the points (1, 2) and (4, 8) with slope 2, b = 2 - 2*1 = 0, so the line crosses the y-axis at the origin.
Does it matter which point you label as the first point?
For slope, distance, and the line equation it makes no difference, because the differences cancel out. It only affects the sign of the angle, delta x, and delta y, which describe direction along the segment.
How do you write the equation of a line from two points?
Compute the slope and y-intercept, then write it as y = mx + b. The points (1, 2) and (4, 8) yield slope 2 and intercept 0, giving the equation y = 2x.
How steep is a 6% slope?
A 6% slope rises 6 units for every 100 units of horizontal run, which is an angle of atan(0.06) ≈ 3.4°. That works out to 0.72 inches per foot (12 × 0.06) or 6 feet over a 100-foot run. It is a gentle grade for walking, though it is noticeable on a bike or with a loaded cart, and some road authorities post grade warning signs at around this steepness (thresholds vary by country).
How much is a 1% slope per foot?
A 1% slope changes height by 0.12 inches per foot, because 12 inches × 0.01 = 0.12 inches, which is about 1/8 inch. Over 100 feet that adds up to 1 foot of rise or fall. In the calculator, a 1% grade appears as a slope of 0.01 and an angle of about 0.57°.
How many inches per foot is a 2% slope?
A 2% slope is 0.24 inches per foot, since 12 × 0.02 = 0.24, or just under 1/4 inch per foot. Over 10 feet that is 2.4 inches, and over 100 feet it is 2 feet. As an angle it is atan(0.02) ≈ 1.15°.
What is a 1% slope in 10 feet?
Over 10 feet, a 1% slope changes height by 0.1 feet, which is 1.2 inches (10 ft × 0.01 = 0.1 ft, and 0.1 × 12 = 1.2 in). Halve that for 5 feet (0.6 in) or double it for 20 feet (2.4 in). Enter the points (0, 0) and (10, 0.1) into the calculator to see the slope of 0.01 directly.

Related calculators

Sources & references

These tools follow our methodology and provide educational estimates only — verify important figures with a qualified professional.