Slope Calculator

Slope, equation and angle of a line through two points.

Free slope calculator — enter two points and get the slope, the line equation in y = mx + b form, and the angle. Runs entirely in your browser, nothing uploaded. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

How is the slope of a line calculated?

Slope (m) = (y₂ − y₁) ÷ (x₂ − x₁) — the change in y divided by the change in x between the two points, sometimes called rise over run.

Slope of a line through two points

The slope (or gradient) measures how steeply a line rises or falls between two points. This tool returns the slope, the line equation and the line’s angle — for students, surveyors and anyone working with linear graphs or gradients.

How it works

The slope is the change in y divided by the change in x, often called “rise over run”:

m = (y₂ − y₁) ÷ (x₂ − x₁)

From the slope and one point, the y-intercept is b = y₁ − m × x₁, giving the line equation y = mx + b. The angle of the line is atan2(Δy, Δx) converted to degrees. A positive slope rises left to right, a negative slope falls, a slope of 0 is horizontal, and a vertical line has an undefined slope because the run is zero — the tool reports this rather than dividing by zero.

Worked example

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

ResultValue
Δy / Δx6 ÷ 3
Slope (m)2
Equationy = 2x + 0
Angle≈ 63.43°

Step by step: the rise is 8 − 2 = 6 and the run is 4 − 1 = 3, so the slope is 6/3 = 2. The y-intercept is 2 − (2 × 1) = 0, giving the equation y = 2x. The angle in degrees is arctan(2) ≈ 63.43°.

Reading the results

Positive slope: the line rises from left to right. A slope of 1 means equal rise and run — a 45° angle.

Negative slope: the line falls from left to right. The steeper the fall, the more negative the value.

Slope of 0: the line is perfectly horizontal — y stays constant no matter what x does. The equation simplifies to y = b.

Undefined slope (vertical line): when both x values are equal, the run is zero and division by zero is undefined. A vertical line has no slope, only an x-intercept of the form x = a.

Converting slope to angle: the arctan function gives the angle in radians; multiply by 180/π to convert to degrees. Note that angles returned by arctan live in the range −90° to 90°, matching the natural range of a non-vertical line’s inclination.

Common uses

  • Algebra coursework: finding line equations from two points is a staple of coordinate geometry.
  • Data analysis: the slope of a best-fit line is the rate of change — how much y changes per unit increase in x.
  • Surveying and engineering: gradient between two elevation points on a profile.
  • Physics: velocity from a displacement-time graph, or force from a potential-energy graph, both read directly as slopes.

All calculations run in your browser, with nothing uploaded.