Skip to main content
Calcimator

Slope Calculator

Calculate the slope, distance, midpoint, and line equation from two points. Visualize rise over run.

About this calculator

This calculator finds the slope, distance, midpoint, and full line equation connecting two coordinate points, working entirely from the rise (the vertical gap Y₂ minus Y₁) and run (the horizontal gap X₂ minus X₁) between them. Slope divides rise by run: raise Y₂ and the numerator, and the slope, climbs, while raising Y₁ pulls the slope down, since rise measures how far you moved up from the first point. The run in the denominator works in reverse — pushing X₂ further right stretches the run and flattens the slope toward zero, while pushing X₁ the other way shrinks the run and steepens the line. The distance between the points and their midpoint come from those same two gaps, independent of which point is labeled first or second.

When the two x-coordinates match exactly, run becomes zero, and rather than letting the division by zero produce a raw Infinity, the page swaps in the text "Undefined (vertical line)" instead of a number, along with a y-intercept of "None (vertical)," since a vertical line never crosses the y-axis at one defined point the way y = mx + b describes — this vertical-line case is handled explicitly. The real gap worth flagging: nothing here checks that the two points you enter are actually distinct. If you enter identical coordinates for both points — a zero-distance pair — run comes out zero, and the calculator reports it the same way it reports a genuine vertical line ("Undefined (vertical line)"), along with a Distance of 0 and an Angle of 0°, even though no line is actually defined by a single repeated point.

Inputs

Results

Slope (m)

2

Line Equationy = 2x + 0
Distance6.7082
Angle63.43°
Midpoint(2.5, 5)
Rise6
Run3
How to Use This Calculator
  1. Enter the coordinates of two points on a line: (x₁, y₁) and (x₂, y₂).
  2. Slope m = (y₂ − y₁) / (x₂ − x₁); positive slope rises left to right, negative slope falls.
  3. Undefined slope occurs when x₁ = x₂ (vertical line); zero slope means a horizontal line.
  4. The y-intercept b is found from y = mx + b rearranged: b = y₁ − m × x₁.
  5. Angle of inclination = arctan(|m|) converts slope to the angle the line makes with the horizontal.
  6. Distance between the two points and the midpoint are also computed using the distance formula.

How the result changes with X₂

X₂Slope (m)
26
33
61.2
100.67

What each input means

X₁
X-coordinate of the first point.
Y₁
Y-coordinate of the first point.
X₂
X-coordinate of the second point.
Y₂
Y-coordinate of the second point.

How this is calculated

Worked example, using the default values

  1. Identify Input Parameters
    4 parameters
    X₁ = 1, Y₁ = 2, X₂ = 4, Y₂ = 8 = 4 input(s) provided
  2. Calculate Slope
    2 = 2
  3. Calculate Line Equation
    y = 2x + 0 = y = 2x + 0
  4. Calculate Distance
    Distance
    6.7082 = 6.7082

Engine last updated . Built by Paul Gunder, a software engineer, not a licensed financial, medical, or legal professional.

Frequently Asked Questions

Why does moving Point 2 to the right make the slope smaller (or more negative)?

Increasing X₂ stretches the run — the horizontal gap X₂ minus X₁ — while the rise between the two points stays the same. Since slope is rise divided by run, a larger run paired with an unchanged rise always produces a smaller quotient, whether that means a gentler positive slope or one that swings further into negative territory.

What happens if I enter the same x-coordinate for both points?

The run (X₂ minus X₁) becomes exactly zero, and dividing the rise by zero has no defined value for a real line — this describes a perfectly vertical line, which has no finite slope at all. Rather than showing Infinity or throwing an error, the calculator reports the slope as "Undefined (vertical line)" and the y-intercept as "None (vertical)" instead of a number.

How is the line equation different when the slope comes out to exactly zero?

A slope of zero describes a perfectly horizontal line, and the general form y = mx + b would just print "y = 0x + b," a needlessly cluttered way to say the line never rises or falls. So the calculator instead prints the simplified equation "y = b," reporting only the constant y-intercept on its own.

Does it matter which point I label as Point 1 versus Point 2?

No — swapping the two points flips the sign of both the rise and the run at the same time, and dividing two negative numbers, or two positive ones, returns the identical slope either way. Distance and midpoint are built from those same symmetric gaps, so they come out the same regardless of point order too.

The questions that sit next to this one — chosen by subject, including calculators filed under a different category.

More in Math & Statistics.