Slope and Line Equation Calculator — Free Online | EverydayCalcSkip to main content
everydaycalc.

Find calculators and file viewers

Press Esc to close · / or Ctrl+K to open

Home›Math & Scientific›Slope and Line Equation Calculator
Math & Scientific

Slope and Line Equation Calculator

Find the slope, y-intercept and equation of a straight line from two coordinate points, with explicit handling of vertical lines.

✦ INSTANT CALCULATION

Slope and Line Equation Calculator

YOUR RESULT
—

ⓘ Calculated locally in your browser. Results depend on the values and units you enter.

Interactive mathematical graph

The axes, points and dimensions are recalculated from the values you enter.

What changes if one input changes?

7: 1.66666666666667 · 8: 2 · 9: 2.33333333333333

How this calculator works

The slope between (x₁,y₁) and (x₂,y₂) is (y₂−y₁)/(x₂−x₁). Find the y-intercept by b=y₁−mx₁, then write y=mx+b. If the X coordinates are equal, the line is vertical, so its slope and y-intercept are not defined; the calculator reports the condition instead of dividing by zero. Two identical points cannot determine a unique line. Results use decimal arithmetic, but some fractional slopes are approximations.

Formula and reasoning

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

  1. 1. Start with the measurements
    First point X1Second point X4First point Y2Second point Y8
  2. 2. Substitute into the formula

    First point X = 1 ? Second point X = 4 ? First point Y = 2 ? Second point Y = 8

  3. 3. Check the computed answer

    Result for the sample inputs2

Worked example

Points (1,2) and (4,8) give rise 6 and run 3, so slope = 2, intercept = 0 and y = 2x.

Frequently asked questions

Can I enter negative coordinates?

Yes. Positive and negative coordinates are supported.

What if the two X values match?

That is a vertical line. Its slope is undefined and the calculator explains why.

Results are informational and assume the stated inputs and formulas. Double-check critical financial or engineering decisions with a qualified professional.

Add this calculator to your website

Share a working calculator on your blog or website. Choose a fixed size or let the height fit the content.

Fixed height

Works on websites that accept iframe HTML.

Responsive height

Automatically adjusts the height. Your website must allow scripts.

Open calculator preview ↗

Powered by EverydayCalc