Free tool — no sign-up

Straight line equation calculator (y = mx + c)

Give the calculator two points and it returns everything a coordinate geometry question can ask for: the gradient, the equation in y = mx + c and in the general form ax + by + c = 0, the midpoint, the exact distance between the points, and the perpendicular bisector. Every value is worked out from your coordinates, including the awkward vertical-line case.

Enter two points A(x₁, y₁) and B(x₂, y₂)

y = 3x − 1

General form: 3x − 1y − 1 = 0

Gradient: 3

y-intercept: (0, -1)

Midpoint: (2.5, 6.5)

Length AB: 3√10 9.486833

Perpendicular gradient: -1/3

Perpendicular bisector: y = -1/3x + 7.333333

The method behind it

  • Gradient m = (y₂ − y₁) / (x₂ − x₁); a vertical line has an undefined gradient.
  • Equation: y − y₁ = m(x − x₁), rearranged to y = mx + c or ax + by + c = 0.
  • Midpoint = ((x₁ + x₂)/2, (y₁ + y₂)/2); length = √((Δx)² + (Δy)²).

How to use this tool

  1. 1. Enter the first point

    Type the x and y coordinates of point A. Negative and decimal coordinates are fine.

  2. 2. Enter the second point

    Type the coordinates of point B. The two points must be different for a line to exist.

  3. 3. Use the form the question asks for

    A Level questions often want ax + by + c = 0 with integer coefficients, while GCSE questions usually want y = mx + c. Both are shown.

Frequently asked questions

How do you find the equation of a line through two points?

Work out the gradient m = (y₂ − y₁) ÷ (x₂ − x₁), then substitute one point into y − y₁ = m(x − x₁) and rearrange into y = mx + c.

What is the gradient of a perpendicular line?

It is the negative reciprocal, −1/m. A line with gradient 2/3 is perpendicular to a line with gradient −3/2, and their product is always −1.

How do you find the distance between two points?

Use Pythagoras: distance = √((x₂ − x₁)² + (y₂ − y₁)²). Leave it in surd form on non-calculator papers.

What is a perpendicular bisector?

The line at right angles to a segment that passes through its midpoint. Find the midpoint, take the negative reciprocal of the gradient, then substitute into y − y₁ = m(x − x₁).

Practise this properly, not just once

A solver gives you the answer; exam marks come from the working. MathsGradeUp pairs exam-board questions with step-by-step feedback and revision notes on the exact topics you keep dropping marks on.

More free tools