Skip to content

Slope Calculator

Math & Calculators ·
·

From two points, get slope, distance, angle, line equation, and midpoint, all the standard line-geometry outputs in one shot.

What you get from two points

Drop in two (x, y) coordinates. The calculator returns:

  • Slope (m): rise over run, the standard slope-intercept m
  • Distance: straight-line distance between the points (Pythagorean)
  • Angle: angle of the line from the positive x-axis, in degrees
  • Midpoint: the (x, y) point exactly halfway between the inputs
  • Equation: the line in slope-intercept form: y = mx + b

All four come from the same two points. Handy for homework, surveying, mapping, and any time you have two coordinates and want the line through them.

Slope formulas

Slope is rise over run:

m = (y₂ - y₁) / (x₂ - x₁)

Three special cases the calculator handles correctly:

  • Vertical line (x₁ = x₂): slope is undefined or “infinite”, the calculator displays ∞ and shows the equation as x = constant.
  • Horizontal line (y₁ = y₂): slope is 0, equation is y = constant.
  • Diagonal line at 45°: slope is exactly 1 (or -1 going the other way).

Distance formula

The distance between two points uses the Pythagorean theorem applied to the differences:

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

This is the straight-line (“Euclidean”) distance, which is what you want for most geometry problems. For driving directions or geographic distances on a curved Earth, you’d use Haversine or great-circle formulas instead.

Line equation in slope-intercept form

Once you have the slope, you can find the y-intercept (b) by plugging in either point:

b = y₁ - m × x₁

The line is then y = mx + b. The calculator displays this fully filled in. For vertical lines (where m doesn’t exist), it shows x = c instead.

Midpoint formula

The midpoint is just the average of the coordinates:

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

Handy for finding the center of a line segment, which comes up in geometric proofs and computer graphics constantly.

What people use this for

  • Algebra/geometry homework: the most common case
  • Surveying: computing the slope of land between two surveyed points
  • Roofing/construction: pitch calculations (rise/run with units)
  • Game development: movement vectors between two screen positions
  • Statistics: slope of a regression line through two data points (this calculator only handles two points; for many points you’d need linear regression)

Slope as a percentage (grade)

Civil engineering often expresses slope as a percentage rather than a unitless number. To convert:

percent = m × 100

A slope of 0.05 is a 5% grade. Steep highway grades are 6-8%; railroad max grades are around 4%; residential streets cap at about 12-15% in most US cities.

Frequently asked questions

My points are negative, does that matter? No. The formulas work for any real numbers. Negative slopes mean the line goes down as x increases.

What if both points are the same? The slope and direction are undefined. The calculator will show NaN or 0, sanity check that your two points are actually distinct.

Why does the angle look weird sometimes? The angle is computed via atan2, which returns angles in the range (-180°, 180°]. A line going from (0,0) to (-1, 1) gives 135°, while (0,0) to (1, -1) gives -45°. Both lines have the same physical direction but different signed angles based on which point you call “first.”

Can I use this for 3D? The calculator handles 2D only. For 3D, distance generalizes (add z² under the square root), but slope between 3D points isn’t a single number, it’s a direction vector.

slope calculator geometry line distance-formula

Related Tools

More in Math & Calculators

Loan Calculator

Calculate monthly payments, total interest, and view amortization schedule

Love Calculator

A fun love compatibility calculator. Enter two names and get a playful match percentage with a cheeky verdict. Same names always give the same score.

Macro Calculator

Turn a daily calorie target into grams of protein, carbs, and fat. Pick a goal and split, or estimate your calories from age, weight, height, and activity.

Matrix Calculator

Add, subtract, multiply matrices and find determinant, transpose, inverse

Markup Calculator

Set your selling price from cost and a markup percent, or work backward from cost and price to find the markup and the profit margin behind it.

Mortgage Calculator

Estimate your real monthly mortgage payment, principal, interest, taxes, insurance, and PMI all in one number.

Number to Words Converter

Convert any number to its English word representation

Pace Calculator

Solve for running pace, finish time, or distance, switch between km and miles, with one-click presets for 5K, 10K, half, and full marathon.

One Rep Max Calculator

Estimate your 1RM from a heavier set using the Epley and Brzycki formulas, plus a full table of training percentages and rep ranges.

Percentage Increase Calculator

Find the percent increase or decrease between two numbers, or grow and shrink any value by a percentage you choose. Both directions, instant results.

Percentage Calculator

Calculate percentages, percentage of a number, and percentage change

Pregnancy Due Date Calculator

Calculate your pregnancy due date from last period, conception, or IVF transfer, with current week and trimester.

View all 73Math & Calculators