Slope Calculator

Find the slope, y-intercept, equation, angle and distance from two points on a line.

Written by Ahmet Tur · Reviewed by Kübra Yıldız · Updated

Your result will appear here

Fill in the fields and press Calculate.

Give two points and this calculator finds the slope of the line through them — how steep it is and which way it tilts — along with the y-intercept, the full equation y = mx + b, the angle of incline, and the distance between the points.

Slope Calculator: step-by-step worked example

The line through A(1, 2) and B(4, 11).

Example inputs
x₁
1
y₁
2
x₂
4
y₂
11
  1. 1

    Rise

    Δy = y₂ − y₁

    11 − 2 = 9

  2. 2

    Run

    Δx = x₂ − x₁

    4 − 1 = 3

  3. 3

    Slope

    m = Δy ÷ Δx

    9 ÷ 3 = 3

  4. 4

    y-intercept

    b = y₁ − m × x₁

    2 − 3 × 1 = -1

  5. 5

    Line equation and angle

    y = mx + b · α = arctan(m)

    = y = 3x − 1 · α = 71.57°

Result · Slope (m)3
The line through both points
146.5-1
x 0: -1x 1: 2x 4: 11x 5: 14
0x5
  • y = 3x − 1:-1 → 14

Good to know: A positive slope rises to the right, a negative one falls; m = 0 is horizontal. If x₁ = x₂ the line is vertical and the slope is undefined. Swapping the points does not change the result.

Slope Calculator — how it works

Slope is rise over run

Slope (m) is the change in y divided by the change in x:

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

SlopeMeaning
PositiveLine rises left to right
NegativeLine falls left to right
ZeroHorizontal line
UndefinedVertical line (x₁ = x₂)

A vertical line has no slope — the run is zero, so the division is undefined.

From slope to the full line

Once you have the slope, the y-intercept (b) is where the line crosses the y-axis: b = y₁ − m·x₁. Together they give the slope-intercept equation y = mx + b. The angle of incline is arctan(m), and the straight-line distance between the points is √((x₂−x₁)² + (y₂−y₁)²) — the Pythagorean theorem again.

Worked example

For the points (1, 2) and (3, 6): the slope is (6 − 2) ÷ (3 − 1) = 4 ÷ 2 = 2. The y-intercept is 2 − 2×1 = 0, so the line is y = 2x. Its angle of incline is arctan(2) ≈ 63.4°, and the distance between the two points is √(2² + 4²) = √20 ≈ 4.47.

Slope, angle and line equation from two points

PointsSlopeAngleEquation
(0, 0) → (1, 1)145°y = x
(0, 0) → (1, 2)263.4°y = 2x
(0, 0) → (2, 1)0.526.6°y = 0.5x
(1, 1) → (4, 3)0.66733.7°y = 0.666667x + 0.333333
(2, 3) → (5, 11)2.66769.4°y = 2.666667x − 2.333333
(0, 5) → (5, 0)-1-45°y = -x + 5
(-2, -1) → (2, 3)145°y = x + 1
(1, 2) → (3, 2)00°y = 0x + 2

Frequently asked questions

How do I calculate the slope between two points?+

Divide the change in y by the change in x: m = (y₂ − y₁) ÷ (x₂ − x₁). For (1, 2) and (3, 6) that’s (6 − 2) ÷ (3 − 1) = 2. The tool also gives the y-intercept and full equation.

What does the slope tell me?+

How steep the line is and its direction. A positive slope rises from left to right, a negative one falls, zero is flat, and a larger absolute value is steeper. A slope of 2 means y increases by 2 for every 1 that x increases.

What is the y-intercept?+

The point where the line crosses the y-axis, i.e. the value of y when x = 0. It’s found with b = y₁ − m·x₁ and is the “b” in the slope-intercept equation y = mx + b.

Why is the slope sometimes undefined?+

When the two points share the same x value, the line is vertical and the run (x₂ − x₁) is zero. Dividing by zero is undefined, so a vertical line has no slope — the calculator flags this instead of returning a number.

How is the angle of the line found?+

By taking the arctangent of the slope: angle = arctan(m), in degrees. A slope of 1 is a 45° incline, a slope of 0 is horizontal (0°), and steeper slopes approach 90°.

Related guides

About this page

Publisher:
Kalkoro — Teknolojig Bilişim Teknolojileri A.Ş., İstanbul
Written by:
Ahmet Tur — Editor (Math, date & time, unit conversion, physics & chemistry, everyday tools)
Reviewed by:
Kübra Yıldız — Editor

Parameters come from official sources; the last update date is shown at the bottom of the page.

Spotted a wrong result? Use the "Report a bug" button at the top of the page; every report is reviewed.

How we calculate and our accuracy policy →

Results are for information only. For official matters the relevant authority's calculation prevails.

Last updated: