tooldeb Online Tools
Categories
Finance & Investing Interest, savings, returns, and inflation. Loans & Property Mortgages, repayment, DSR/DTI/LTV, and jeonse. Tax & Payroll Take-home pay, severance, insurance, and taxes. Shopping & Pricing Discounts, tips, unit price, and margins. Health & Fitness Body metrics, nutrition, and training. Math Percentages, fractions, algebra, and sequences. Geometry Area, volume, and surface of plane and solid shapes. Statistics & Probability Averages, spread, combinations, and odds. Unit Conversion Length, weight, temperature, pressure, and more. IT & Digital Data size, screens, color, and network speed. Engineering & Electronics Circuits, resistance, PCB, and signals. Date & Time Ages, D-day, date math, and time zones. Home & Interior Paint, tile, wallpaper, flooring, and concrete. Automotive Fuel cost, economy, tires, and vehicle tax. Everyday Bills, delivery, photos, and odds and ends.
EN
한국어 English

Line Slope & Equation Calculator (Two Points)

Find the slope and the equation of the line (y = mx + b) that passes through two given points.

Inputs
Slope (m)
2.0000
Y-intercept (b)
1.0000
If the two x-coordinates are equal, the line is vertical and its slope is undefined — the result shows "—". Results are rounded for display.

How the slope and equation are calculated

The slope measures how much y changes for each unit of x between the two points. Once you have the slope, plugging either point back in solves for the y-intercept, giving the full line equation.

m = (y2 − y1) / (x2 − x1) b = y1 − m × x1 y = mx + b
  • x1, y1 — coordinates of the first point
  • x2, y2 — coordinates of the second point
  • m — slope of the line
  • b — y-intercept, where the line crosses the y-axis

More detail

What the slope's sign means

A positive slope means the line rises left to right; a negative slope means it falls. A slope of 0 is a flat horizontal line. If x1 equals x2, the two points sit on a vertical line, where slope is mathematically undefined (division by zero) — the calculator shows "—" instead of a number.

From two points to a full equation

Once the slope m is known, substituting either point's coordinates into y = mx + b and solving for b pins down exactly where the line crosses the y-axis. Either point gives the same b, since both lie on the same line.

Quick check. Points (1, 3) and (4, 9) give slope 2 and y-intercept 1, so the line is y = 2x + 1 — a fast way to sanity-check the calculator.

Frequently asked questions

How do you find the slope between two points?

Slope m = (y2 − y1) / (x2 − x1) — the change in y divided by the change in x. For points (1, 3) and (4, 9), that's (9 − 3) / (4 − 1) = 2.

What is the y-intercept and how is it calculated?

The y-intercept b is where the line crosses the y-axis (x = 0). Once you know the slope m, plug either point into b = y1 − m × x1. For (1, 3) with slope 2, b = 3 − 2 × 1 = 1.

Why does the calculator show "—" for some point pairs?

When the two points share the same x-coordinate (x1 = x2), the line is vertical. A vertical line's slope is undefined since the formula divides by (x2 − x1) = 0, so the result field shows "—" instead of a number.

What does the full line equation look like?

Once you have slope m and y-intercept b, the line's equation is y = mx + b. For points (1, 3) and (4, 9), the calculator gives m = 2 and b = 1, so the equation is y = 2x + 1.

Does it matter which point I enter first?

No. Swapping point 1 and point 2 gives the same slope and y-intercept, since both (y2 − y1)/(x2 − x1) and its reversed form (y1 − y2)/(x1 − x2) reduce to the same value.

Related calculators

Browse all Geometry calculators