Slope Calculator tool

Slope Calculator

A slope calculator computes the slope (m) of a line connecting two points, the straight-line distance between those points, and the equation of the line in slope-intercept form (y = mx + b).

What is a slope calculator?

A slope calculator finds the slope of the line through two points, the distance between them, and the slope-intercept equation y = mx + b. Slope m equals rise over run: (y₂ − y₁) / (x₂ − x₁). A small graph marks both points and the connecting line. Vertical lines show undefined slope because the run is zero.

How to use the Slope Calculator

  1. Enter X₁ and Y₁ for the first point.
  2. Enter X₂ and Y₂ for the second point.
  3. Read slope m and y-intercept b in the stat cards.
  4. Copy the line equation string for your graph paper.
  5. Check distance if you need segment length between points.

About this calculator

A slope calculator computes the slope (m) of a line connecting two points, the straight-line distance between those points, and the equation of the line in slope-intercept form (y = mx + b). Slope measures the steepness and direction of a line.

Slope has practical applications in construction (ramp gradients), geography (hill gradients), physics (velocity-time graphs), economics (marginal rates), and data analysis (linear regression).

How the math works

m=y2−y1x2−x1m = \frac{y_2 - y_1}{x_2 - x_1}
  • mm: Slope (rise over run)
  • (x1,y1)(x_1, y_1): First coordinate point
  • (x2,y2)(x_2, y_2): Second coordinate point

Slope example: line through (1, 2) and (4, 8)

Find slope between (1, 2) and (4, 8). Rise is 8 − 2 = 6 and run is 4 − 1 = 3, so m = 6/3 = 2. Using y − y₁ = m(x − x₁): y − 2 = 2(x − 1), which expands to y = 2x + 0. Intercept b = 0. Distance = √(3² + 6²) = √45 ≈ 6.7082.

Enter those coordinates. Slope should read 2.0000 and equation y = 2.0000x + 0.0000. If x₁ equals x₂ the line is vertical and the tool reports undefined slope while still showing distance. Negative slope means y falls as x increases, common on cooling curves in school physics graphs.

Parallel lines share the same m but different b values; perpendicular slopes multiply to −1 when neither line is vertical. Points (0,0) and (5,10) give slope 2 and line y equals 2x. Horizontal line y1 equals y2 gives slope 0. Vertical x1 equals x2 shows undefined slope in the tool. Distance between the two input points appears beside slope in the results grid.

Common uses

  • Find the slope between two data points in statistics
  • Calculate the gradient of a road or ramp for construction
  • Determine the equation of a line through two known points
  • Find the angle of inclination from slope

Frequently asked questions

What is the slope formula?

Slope m = (y₂ − y₁) / (x₂ − x₁). A positive slope indicates an upward trend from left to right, a negative slope indicates a downward trend, zero slope means a horizontal line, and undefined slope means a vertical line.

What is the slope between (0, 0) and (5, 10)?

2. Rise 10 − 0 = 10 and run 5 − 0 = 5, so m = 10/5 = 2. Enter the points and the calculator returns slope 2 and equation y = 2x when the intercept is 0.

How do I find the y-intercept from two points?

Compute m = (y₂ − y₁)/(x₂ − x₁), then b = y₁ − m x₁. The tool does both after you enter (x₁, y₁) and (x₂, y₂). The intercept is where the line crosses the y-axis at x = 0.

What slope does a horizontal line have?

Zero. If y₁ = y₂ the rise is 0, so m = 0 and the equation is y = b. The graph is flat. Vertical lines have undefined slope because the run is 0.

Related calculators

Maintained by J Jaya Prakash · Last updated: October 2026