Math

Slope calculator

Settings
Reset
Share
Save
Embed
Report a bug

Share calculator

Add our free calculator to your website

Please enter a valid URL. Only HTTPS URLs are supported.


Use as default values for the embed calculator what is currently in input fields of the calculator on the page.


Input border focus color, switchbox checked color, select item hover color etc.


Please agree to the Terms of Use.

Preview

Save calculator

Calculator Settings

Please enter a value within the allowed range.

Please enter a value within the allowed range.

Please enter a value within the allowed range.

Please enter a value within the allowed range.

Share calculator

What is a slope calculator?

A slope calculator finds the steepness of the straight line that passes through two points on a coordinate plane. The slope, usually written as mm, describes how much the line rises (or falls) vertically for each unit it moves horizontally. It is one of the most fundamental quantities in coordinate geometry and shows up everywhere from algebra to physics, road design, and statistics.

Given two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2), this calculator returns a single dimensionless number — the rise divided by the run.

Key concepts

  • Point — an ordered pair (x,y)(x, y) that locates a position on the plane.
  • Rise — the vertical change between the two points, y2y1y_2 - y_1.
  • Run — the horizontal change between the two points, x2x1x_2 - x_1.
  • Slope (m) — the ratio of rise to run. A pure number with no units when both axes use the same unit.

How does the calculator work?

The slope between two points is defined as the ratio of the vertical change to the horizontal change:

m=y2y1x2x1m = \frac{y_2 - y_1}{x_2 - x_1}

Enter the coordinates of the two points and the calculator immediately returns the slope. If x1=x2x_1 = x_2, the line is vertical and the slope is undefined — the calculator leaves the result empty in that case, because dividing by zero has no meaningful value.

What the sign of the slope means

  • Positive slope (m>0m > 0) — the line goes up from left to right.
  • Negative slope (m<0m < 0) — the line goes down from left to right.
  • Zero slope (m=0m = 0) — the line is horizontal; the yy values are equal.
  • Undefined slope — the line is vertical; the xx values are equal and the denominator is zero.

Worked examples

Example 1: positive slope

For the points (0,0)(0, 0) and (1,1)(1, 1):

m=1010=1m = \frac{1 - 0}{1 - 0} = 1

The line rises one unit for every unit it moves to the right — a 45° angle.

Example 2: steeper positive slope

For the points (0,0)(0, 0) and (2,4)(2, 4):

m=4020=2m = \frac{4 - 0}{2 - 0} = 2

The line rises twice as fast as it runs.

Example 3: horizontal line

For the points (1,2)(1, 2) and (3,2)(3, 2):

m=2231=02=0m = \frac{2 - 2}{3 - 1} = \frac{0}{2} = 0

Both points share the same yy, so the line is horizontal.

Example 4: vertical line (undefined)

For the points (2,1)(2, 1) and (2,5)(2, 5):

m=5122=40=undefinedm = \frac{5 - 1}{2 - 2} = \frac{4}{0} = \text{undefined}

The line is vertical. The calculator returns an empty value because the slope does not exist.

Example 5: negative slope

For the points (0,4)(0, 4) and (2,0)(2, 0):

m=0420=2m = \frac{0 - 4}{2 - 0} = -2

The line falls two units for every unit it moves to the right.

Practical uses

  • Geometry and algebra — finding the equation of a line in slope-intercept form y=mx+by = mx + b.
  • Construction and civil engineering — expressing the grade of a road, ramp, or roof. A grade of 5% is a slope of 0.05.
  • Physics — reading velocity from a position-time graph, or acceleration from a velocity-time graph.
  • Statistics — the slope of a regression line measures the average change in one variable per unit change in another.
  • Cartography and hiking — relating elevation change to horizontal distance from a topographic map. Pair this with the distance-2d calculator to compute the actual length of the segment, or with the midpoint calculator to locate the point halfway along it.

Notes

  • The slope is dimensionless when both coordinates are measured in the same unit. The calculator converts inputs internally so that mixing units (for example, xx in cm and yy in m) still gives a correct ratio.
  • The order of the two points does not matter: swapping (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) negates both rise and run, leaving the slope unchanged.
  • A vertical line has no defined slope. Some texts say the slope is “infinite,” but in practice it is left undefined.
  • Slope is closely related to the Pythagorean theorem: the rise, run, and the distance between the two points form a right triangle.

Report a bug

This field is required.