Line Equation from Two Points Calculator

Enter the coordinates of two points to get the equation of the line passing through them (slope-intercept, general, and point-slope forms), the step-by-step solution, and the graph.

Point 1
( , )
Point 2
( , )

Quick Examples

Rate this tool

How to Use This Calculator

This online calculator finds the equation of a line given two points. Designed for algebra and analytic geometry students, this solver not only provides the final line formula, but it also explains the procedure step by step.

Using this line equation finder is very simple:

  1. Enter the data: Type the (x, y) coordinates of the two points you know. Double-check the signs before clicking calculate. The input fields accept integers, fractions, and decimals.
  2. Main results: You will instantly see a box with the line expressed in several forms: the slope-intercept form (y = mx + b), the point-slope form (y - y₁ = m(x - x₁)), and the general form (Ax + By + C = 0). It also shows you the slope (m) and the y-intercept (b).
  3. Step-by-step: Further down, you will find the complete breakdown of the problem. You will see how the slope is calculated using m = (y₂ - y₁) / (x₂ - x₁), how the point-slope equation is set up with two points (by picking one of them), and then how it is rearranged to reach the slope-intercept and general forms.
  4. Interactive graph: At the very bottom, there is a graph on the Cartesian plane. You can move it around to see the slope of the line, verify that it passes through the points you entered, and read the equation directly on the image.

Solved Exercises

The following are examples of problems solved by the calculator.

Calculate the equation of the straight line from the points (1, 2) and (4, 6).
Slope-intercept form
$$ y = \dfrac{4}{3}x + \dfrac{2}{3} $$
Point-slope form
$$ y - 2 = \dfrac{4}{3}\left(x - 1\right) $$
General form
$$ 4x - 3y + 2 = 0 $$

Slope: \( m = \dfrac{4}{3} \approx 1.33 \)

y-intercept: \( b = \dfrac{2}{3} \approx 0.67 \)

Step-by-step solution

1. Identify the coordinates of the points.

The given points are:

$$ P_1\left(1, 2\right) \quad P_2\left(4, 6\right) $$

We extract the coordinates:

$$ \begin{aligned} x_1 &= 1, & y_1 &= 2 \\[1em] x_2 &= 4, & y_2 &= 6 \end{aligned} $$

2. Calculate the slope (m) of the line.

The slope formula given two points is:

$$ m = \dfrac{y_2 - y_1}{x_2 - x_1} $$

Substituting the values:

$$ m = \dfrac{6 - 2}{4 - 1} = \dfrac{4}{3} = \dfrac{4}{3} $$

3. Set up the point-slope equation.

We take the calculated slope m and the coordinates of the first point and substitute them into the formula:

$$ y - y_1 = m\left(x - x_1\right) $$
$$ y - 2 = \dfrac{4}{3}\left(x - 1\right) $$

4. Solve for 'y' to obtain the slope-intercept form.

$$ y = \dfrac{4}{3}x + \dfrac{2}{3} $$

Moving everything to the left side, we get the general equation:

$$ 4x - 3y + 2 = 0 $$
Graph of the straight line given two points on the Cartesian plane.
Graph of the line passing through two given points
Determine the equations of the line given the points (-2, 5) and (3, -1).
Slope-intercept form equation
$$ y = -\dfrac{6}{5}x + \dfrac{13}{5} $$
Point-slope form equation
$$ y - 5 = -\dfrac{6}{5}\left(x + 2\right) $$
General form equation
$$ 6x + 5y - 13 = 0 $$

Slope: \( m = -\dfrac{6}{5} = -1.2 \)

y-intercept: \( b = \dfrac{13}{5} = 2.6 \)

Step-by-step solution

1. Identify the coordinates of the points.

The given points are:

$$ P_1\left(-2, 5\right) \quad P_2\left(3, -1\right) $$

We extract the coordinates:

$$ \begin{aligned} x_1 &= -2, & y_1 &= 5 \\[1em] x_2 &= 3, & y_2 &= -1 \end{aligned} $$

2. Calculate the slope (m) of the line.

The slope formula given two points is:

$$ m = \dfrac{y_2 - y_1}{x_2 - x_1} $$

Substituting the values:

$$ m = \dfrac{-1 - 5}{3 - \left(-2\right)} = \dfrac{-6}{5} = -\dfrac{6}{5} $$

3. Set up the point-slope equation.

We take the calculated slope m and the coordinates of the first point and substitute them into the formula:

$$ y - y_1 = m\left(x - x_1\right) $$
$$ y - 5 = -\dfrac{6}{5}\left(x + 2\right) $$

4. Solve for 'y' to obtain the slope-intercept form.

$$ y = -\dfrac{6}{5}x + \dfrac{13}{5} $$

Moving everything to the left side, we get the general equation:

$$ 6x + 5y - 13 = 0 $$
Graph of the straight line passing through two given points on the Cartesian plane, example 2.
Graph of the straight line on the plane
Find the equation of the line passing through points (1/2, 3/4) and (-5/2, 1/4).
Slope-intercept form
$$ y = \dfrac{1}{6}x + \dfrac{2}{3} $$
Point-slope form
$$ y - \dfrac{3}{4} = \dfrac{1}{6}\left(x - \dfrac{1}{2}\right) $$
General form
$$ x - 6y + 4 = 0 $$

Slope: \( m = \dfrac{1}{6} \approx 0.17 \)

y-intercept: \( b = \dfrac{2}{3} \approx 0.67 \)

Step-by-step solution

1. Identify the coordinates of the points.

The given points are:

$$ P_1\left(1/2, 3/4\right) \quad P_2\left(-5/2, 1/4\right) $$

We extract the coordinates:

$$ \begin{aligned} x_1 &= \dfrac{1}{2}, & y_1 &= \dfrac{3}{4} \\[1em] x_2 &= -\dfrac{5}{2}, & y_2 &= \dfrac{1}{4} \end{aligned} $$

2. Calculate the slope (m) of the line.

The slope formula given two points is:

$$ m = \dfrac{y_2 - y_1}{x_2 - x_1} $$

Substituting the values:

$$ m = \dfrac{\dfrac{1}{4} - \dfrac{3}{4}}{-\dfrac{5}{2} - \dfrac{1}{2}} = \dfrac{-\dfrac{1}{2}}{-3} = \dfrac{1}{6} $$

3. Set up the point-slope equation.

We take the calculated slope m and the coordinates of the first point and substitute them into the formula:

$$ y - y_1 = m\left(x - x_1\right) $$
$$ y - \dfrac{3}{4} = \dfrac{1}{6}\left(x - \dfrac{1}{2}\right) $$

4. Solve for 'y' to obtain the slope-intercept form.

$$ y = \dfrac{1}{6}x + \dfrac{2}{3} $$

Moving everything to the left side, we get the general equation:

$$ x - 6y + 4 = 0 $$
Graph of the straight line passing through two given points on the Cartesian plane, example 3.
Graph of the line on the Cartesian plane

Related Tools

Daniel Machado

Professor of Mathematics, graduated from the Faculty of Exact, Chemical and Natural Sciences of the National University of Misiones (UNAM). Developer and creator of RigelUp, dedicated to building tools for mathematical learning.

Leave a Reply

Your email address will not be published. Required fields are marked *