# Slope Calculator

URL: https://hifreetools.com/calculators/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.

## 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

- Slope: m = (y₂ − y₁) / (x₂ − x₁)
- Y-intercept: b = y₁ − m · x₁
- Line equation: y = m·x + b
- Angle of inclination: θ = arctan(m), in degrees

## Examples

- Positive slope through (1, 2) and (4, 8): x1 = 1, y1 = 2, x2 = 4, y2 = 8 → m = 2, b = 0, y = 2x, angle ≈ 63.4349°
- Negative slope through (−3, 4) and (2, −1): x1 = −3, y1 = 4, x2 = 2, y2 = −1 → m = −1, b = 1, y = −x + 1, angle = −45°
- Horizontal line through (0, 3) and (5, 3): x1 = 0, y1 = 3, x2 = 5, y2 = 3 → m = 0, b = 3, y = 3, angle = 0°
- Vertical line through (2, 5) and (2, 9): x1 = 2, y1 = 5, x2 = 2, y2 = 9 → Slope undefined (vertical line x = 2)

## FAQ

**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

- [Wikipedia — Slope](https://en.wikipedia.org/wiki/Slope)
- [Wikipedia — Linear equation (slope-intercept form)](https://en.wikipedia.org/wiki/Linear_equation)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "Slope Calculator", https://hifreetools.com/calculators/slope-calculator
