Two-Point Straight Line Calculator with Steps

Find the equation through two distinct points, including gradient, y-intercept and vertical-line classification with coordinate working.

Free learning toolValidated inputs and visible working
Rise over run measures a line's changeKeeping each coordinate pair intact makes the vertical and horizontal differences describe one slope.
YOUR RESULT

Your gradient and line equation

Enter your values

Choose an example or type the known values, then calculate to see the answer and working.

    Change, coordinate order and intercepts

    Gradient measures change

    A positive gradient rises as x increases; a negative gradient falls. Its magnitude states the change in y for each one-unit increase in x, so it may carry a compound contextual unit.

    Coordinate pairs must stay intact

    Swapping only the y values creates different points. Either point can be first, but the chosen subtraction direction must be consistent for both coordinates.

    The intercept is a value, not a point label

    In y = mx + c, c is the y-value when x = 0. The y-intercept point is (0,c). It need not be one of the two entered points.

    How two points determine a straight line

    Two distinct points determine one straight line. For a non-vertical pair, this calculator finds the change in y, change in x, gradient and y-intercept, then reports the rule in y = mx + c form. When both x-coordinates match, it reports the vertical rule x = constant and explains why the gradient is undefined. Coordinate order still matters: each x value must remain paired with its own y value.

    When coordinate data describes a non-vertical line

    Use it when two different coordinate pairs on the same straight line are known. It does not test whether measured points are approximately linear or calculate a statistical line of best fit. A repeated point is insufficient because infinitely many lines pass through one location. Keep the same subtraction order in numerator and denominator for a non-vertical line.

    Worked example: Find the line through (2,5) and (6,17)

    Both coordinates increase, so a positive gradient is expected.

    Prediction first

    Estimate the sign, scale, range or likely form of the answer before calculating. A prediction makes an input error easier to notice.

    1. Step

      Find change in y: 17 - 5 = 12.

    2. Step

      Find change in x: 6 - 2 = 4, so m = 12 ÷ 4 = 3.

    3. Step

      Use the first point to find c: 5 = 3(2) + c, giving c = -1.

    4. Step

      The rule is y = 3x - 1. Substituting x = 6 returns y = 17.

    Straight-line errors that alter slope or position

    Two-Point Straight Line Calculator error check
    MistakeWhy it failsBetter check
    Reversing only one subtractionUsing y₂ - y₁ over x₁ - x₂ changes the gradient sign.Subtract coordinates in the same point order.
    Reading rise without runA vertical change alone does not define slope.Divide change in y by the matching change in x.
    Forcing a vertical line into y = mx + cZero change in x makes the gradient undefined.Report the vertical equation x = x₁ instead.

    Use the equation to predict another point

    The result points to related practice, but the best next step depends on what the learner could explain without help.

    Two-Point Straight Line Calculator questions

    Does the order of the two points matter?

    No, if both numerator and denominator use the same order. Reversing both changes two signs and preserves their quotient.

    Can the gradient be a fraction?

    Yes. A fractional gradient often expresses a meaningful rate and should remain exact unless the context requests a decimal.

    Is this linear regression?

    No. It finds the exact line through two points. A best-fit line for many scattered observations requires statistical modelling.

    Explore OpenSchoolbag

    Choose a page and go there directly.

    Explore learningChoose a learning path
    Quick navigationGo deeper into OpenSchoolbag

    Explore

    Education magazineResource libraryLearning collections

    Plan and practise

    Study plannerMaths practice testSearch the site

    OpenSchoolbag

    Frequently asked questionsAbout the siteEditorial policyContactView the full directory