Skip to main content
ilovecalcs logoilovecalcs.

Math · Live

Slope, distance, midpoint & line equations.

Enter two coordinate points to instantly compute slope, distance, midpoint, angle of inclination, intercepts, and all three standard forms of the line, with a step-by-step notepad and interactive graph.

How it worksReal-time

Inputs

Two points

Line equation

y = 4/3x + 0.6667

Point P₁

Point P₂

Slope m
1.333333
Δx (run)
3
Δy (rise)
4
y-intercept
0.6667
Angle θ
53.1301°

Slope

Positive — rises
m = 4/3

rise = 4, run = 3, distance = 5

Distance
5
Midpoint
(2.5, 4)
y-intercept
(0, 0.6667)
x-intercept
(-0.5, 0)

Equations

Three ways to write the same line.

Slope-intercept
y = mx + b

y = 4/3x + 0.6667

Point-slope
y − y₁ = m(x − x₁)

y − 2 = 4/3(x − 1)

Standard form
Ax + By = C

4x − 3y = -2

Math notepad

Step-by-step calculations.

handworked

Slope m = (y₂ − y₁) / (x₂ − x₁):

m = (6 − 2) / (4 − 1)

m = 4 / 3

m = 4/3 ≈ 1.333333

Distance d = √((x₂ − x₁)² + (y₂ − y₁)²):

d = √((3)² + (4)²)

d = √(9 + 16)

d = √25

d = 5

Midpoint M = ((x₁ + x₂)/2, (y₁ + y₂)/2):

M = ((1 + 4)/2, (2 + 6)/2)

M = (2.5, 4)

y-intercept b = y₁ − m·x₁:

b = 2 − (1.333333)·(1)

b = 0.666667

Line equation y = mx + b:

y = 4/3x + 0.6667

Graph

y = 4/3x + 0.6667

LineP₁, P₂Midpoint
P₁
(1, 2)
P₂
(4, 6)
Midpoint
(2.5, 4)
Distance
5

Field guide

How slope and line properties work.

Two points determine a unique straight line. Everything about that line, its steepness, direction, length, exact equation, follows from a handful of formulas derived from coordinate geometry. This guide walks through each one.

The slope formula

Slope measures how steeply a line rises or falls. It is defined as rise over run: the vertical change divided by the horizontal change between any two points on the line.

m = (y₂ − y₁) / (x₂ − x₁) = Δy / Δx

For the default points (1, 2) and (4, 6):

m = (6 − 2) / (4 − 1) = 4 / 3 ≈ 1.333

The sign of the slope tells you the direction. A positive slope means the line rises left to right. A negative slope means it falls. A slope of zero is a horizontal line. An undefined slope (vertical line) occurs when the two x-coordinates are equal.

The distance formula

The distance between two points is the length of the straight line segment connecting them, calculated from the Pythagorean theorem:

d = √((x₂ − x₁)² + (y₂ − y₁)²)

The horizontal and vertical distances (Δx and Δy) form the two legs of a right triangle; the segment connecting the two points is the hypotenuse. For (1, 2) to (4, 6): d = √(9 + 16) = √25 = 5.

The midpoint formula

The midpoint is exactly halfway between two points, the average of the x-coordinates and the average of the y-coordinates:

M = ((x₁ + x₂) / 2, (y₁ + y₂) / 2)

For (1, 2) and (4, 6): M = (2.5, 4). The midpoint always lies on the line and bisects the segment into two equal halves.

The three forms of a linear equation

Every non-vertical line can be written in three standard forms. All three describe the same line; they just express it differently:

Slope-intercept form: y = mx + b

The most common form. m is the slope and b is the y-intercept (where the line crosses the y-axis). To find b: substitute a known point and solve.

b = y₁ − m·x₁

Point-slope form: y − y₁ = m(x − x₁)

The most natural form when you have a slope and any point on the line. Useful for writing the equation quickly without first finding the y-intercept. Rearranging gives slope-intercept form.

Standard form: Ax + By = C

Common in algebra courses. A, B, and C are typically integers with A ≥ 0. For slope 4/3 and y-intercept 2/3: multiply through by 3 to clear fractions → 4x − 3y = −2.

Intercepts

The y-intercept is where the line crosses the y-axis (x = 0). Substitute x = 0 into y = mx + b → y = b.

The x-intercept is where the line crosses the x-axis (y = 0). Substitute y = 0 into y = mx + b → x = −b/m. Horizontal lines (m = 0) never cross the x-axis unless they lie on it. Vertical lines (undefined slope) have their x-intercept at x = c.

Angle of inclination

The angle of inclination θ is the angle a line makes with the positive x-axis, measured counterclockwise:

θ = arctan(m) [degrees]

A slope of 1 corresponds to 45°; a slope of 0 gives 0°; negative slopes give negative angles. Vertical lines have an inclination of 90°. The angle is useful in physics (inclined planes), engineering (grades), and geography (gradients).

Special line types

  • Horizontal line: slope = 0, equation y = c. All points have the same y-coordinate. The x-axis itself is y = 0.
  • Vertical line: slope is undefined (division by zero), equation x = c. All points have the same x-coordinate. No y-intercept unless c = 0.
  • Lines through the origin: y-intercept b = 0, equation y = mx. Pass through (0, 0).
  • Perpendicular lines: slopes are negative reciprocals: m₁ × m₂ = −1.
  • Parallel lines: same slope, different y-intercepts. Never intersect.

Worked examples

Example 1: 3-4-5 Pythagorean triple: P₁(1, 2), P₂(4, 6). Slope = 4/3, distance = 5, midpoint = (2.5, 4), y-intercept = 2/3. Line: y = (4/3)x + 2/3, or 4x − 3y = −2 in standard form.

Example 2: horizontal line: P₁(−3, 5), P₂(7, 5). Slope = 0, line = y = 5, distance = 10, midpoint = (2, 5).

Example 3: vertical line: P₁(4, −2), P₂(4, 8). Slope = undefined, line = x = 4, distance = 10, midpoint = (4, 3).

Tips for using this calculator

  • Enter negative coordinates by typing a minus sign first — e.g., −3 for the x-coordinate.
  • The step-by-step notepad shows every intermediate calculation so you can follow (and verify) the work by hand.
  • For fractional slopes, the calculator detects when both coordinate differences are integers and displays the exact fraction alongside the decimal.
  • Use the graph to visually confirm that the line passes through both points — the midpoint is marked as an amber dot.