Free Slope Calculator

Find the slope of a line through two points, plus its y-intercept, full equation y = mx + b, and the angle it makes with the x-axis.

Enter two points to find the slope, intercept, equation, and angle.

Result
Slope (m)2
Y-intercept (b)0
Equationy = 2x
Angle (ΞΈ)63.4349Β°

m = (yβ‚‚ βˆ’ y₁) / (xβ‚‚ βˆ’ x₁), b = y₁ βˆ’ mΒ·x₁, and ΞΈ = arctan(m). When xβ‚‚ = x₁ the line is vertical and the slope is undefined.

Quick answer

The slope between two points is m = (y2 βˆ’ y1) / (x2 βˆ’ x1) β€” the change in y divided by the change in x. For example, through (1, 2) and (4, 8), m = (8 βˆ’ 2) / (4 βˆ’ 1) = 6 / 3 = 2, so the line rises 2 units for every 1 unit right. The y-intercept is b = y1 βˆ’ mΒ·x1 = 2 βˆ’ 2Β·1 = 0, giving the equation y = 2x.

Formula & method

Slope

m = (yβ‚‚ βˆ’ y₁) / (xβ‚‚ βˆ’ x₁)
  • m β€” slope of the line
  • (x₁, y₁) β€” coordinates of the first point
  • (xβ‚‚, yβ‚‚) β€” coordinates of the second point

Rise over run: vertical change divided by horizontal change. Undefined when xβ‚‚ = x₁ (a vertical line).

Y-intercept

b = y₁ βˆ’ m Β· x₁

The y-value where the line crosses the y-axis (x = 0). Either point can be substituted; both give the same b.

Line equation

y = mΒ·x + b

Slope-intercept form. Combine the computed m and b to describe the full line.

Angle of inclination

ΞΈ = arctan(m), in degrees

The angle the line makes with the positive x-axis. Positive slope gives 0°–90Β°, negative slope gives βˆ’90°–0Β°.

Examples

Example 1: Positive slope through (1, 2) and (4, 8)
Input
x1 = 1, y1 = 2, x2 = 4, y2 = 8
Result
m = 2, b = 0, y = 2x, angle β‰ˆ 63.4349Β°
Why
m = (8 βˆ’ 2) / (4 βˆ’ 1) = 6 / 3 = 2. b = 2 βˆ’ 2Β·1 = 0, so y = 2x. The angle is arctan(2) β‰ˆ 63.4349Β°.
Example 2: Negative slope through (βˆ’3, 4) and (2, βˆ’1)
Input
x1 = βˆ’3, y1 = 4, x2 = 2, y2 = βˆ’1
Result
m = βˆ’1, b = 1, y = βˆ’x + 1, angle = βˆ’45Β°
Why
m = (βˆ’1 βˆ’ 4) / (2 βˆ’ (βˆ’3)) = βˆ’5 / 5 = βˆ’1. b = 4 βˆ’ (βˆ’1)Β·(βˆ’3) = 4 βˆ’ 3 = 1, so y = βˆ’x + 1. arctan(βˆ’1) = βˆ’45Β°.
Example 3: Horizontal line through (0, 3) and (5, 3)
Input
x1 = 0, y1 = 3, x2 = 5, y2 = 3
Result
m = 0, b = 3, y = 3, angle = 0Β°
Why
m = (3 βˆ’ 3) / (5 βˆ’ 0) = 0 / 5 = 0. A zero slope is a flat line: b = 3 βˆ’ 0Β·0 = 3, so y = 3, with angle arctan(0) = 0Β°.
Example 4: Vertical line through (2, 5) and (2, 9)
Input
x1 = 2, y1 = 5, x2 = 2, y2 = 9
Result
Slope undefined (vertical line x = 2)
Why
Here x2 = x1 = 2, so the run (x2 βˆ’ x1) = 0 and dividing by zero is undefined. The line is vertical, written x = 2, and has no finite slope or y-intercept.

When to use this tool

  • Finding how steep a line, ramp, road, or roof is from two known points or measurements.
  • Writing the slope-intercept equation y = mx + b of a line for algebra, graphing, or geometry homework.
  • Computing the rate of change between two data points (e.g. how fast a quantity rises per unit of time).
  • Checking whether two lines are parallel (equal slopes) or perpendicular (slopes whose product is βˆ’1).

Common mistakes

  • Subtracting the coordinates in a different order top and bottom β€” e.g. using (y2 βˆ’ y1) over (x1 βˆ’ x2). Keep both differences in the same direction or you flip the sign of the slope.
  • Putting x in the numerator. Slope is rise over run: the change in y goes on top, the change in x on the bottom.
  • Forgetting that a vertical line (x2 = x1) has an undefined slope, not a slope of 0. A slope of 0 is a horizontal line.
  • Mishandling negative coordinates β€” subtracting a negative is the same as adding, so x2 βˆ’ (βˆ’3) = x2 + 3. Dropping the double-negative gives the wrong run.

Frequently asked questions

What is the formula for slope between two points?

Slope is m = (y2 βˆ’ y1) / (x2 βˆ’ x1), the change in y divided by the change in x. This is often remembered as 'rise over run.' For (1, 2) and (4, 8) it gives (8 βˆ’ 2) / (4 βˆ’ 1) = 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, because the rise (y2 βˆ’ y1) is zero. Its equation is simply y = b. This is different from an undefined slope, which is a vertical line.

Why is the slope of a vertical line undefined?

For a vertical line, both points share the same x-value, so the run x2 βˆ’ x1 equals 0. Division by zero is undefined, so the slope has no number. The line is written as x = constant instead of y = mx + b.

How do I find the y-intercept once I have the slope?

Plug one point and the slope into b = y βˆ’ mΒ·x. Using (1, 2) with m = 2 gives b = 2 βˆ’ 2Β·1 = 0. You can use either point β€” both yield the same intercept β€” and then write the line as y = mx + b.

How do I convert a slope into an angle?

Take the inverse tangent of the slope: angle = arctan(m), then convert to degrees. A slope of 1 is 45Β°, a slope of 2 is about 63.43Β°, and a slope of 0 is 0Β°. Negative slopes give negative angles (going downhill left-to-right).

What does a negative slope tell me?

A negative slope means the line falls as you move from left to right: y decreases while x increases. For example, a slope of βˆ’1 drops one unit down for every unit right and makes a βˆ’45Β° angle with the x-axis.

Sources & references

External references open in a new tab. We are independent and not affiliated with these organizations.

  • βœ“ Free to use
  • βœ“ No sign-up required
  • βœ“ Runs entirely in your browser β€” nothing is uploaded.
  • βœ“ Formula and method shown above

Provided β€œas is” for general information only β€” results may be inaccurate, so verify before you rely on them. No warranty; use at your own risk.

Built and reviewed by HIFreeTools against the formula shown above and any authoritative references cited on this page. See our methodology and editorial standards.

Related tools

Embed this tool on your site

Free to embed, no sign-up. Paste this code where you want the slope calculator to appear: