CalcCafe

Slope Calculator

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

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.

Related calculators