Equation of a Line Calculator (Free, with Graph)

AlgebraFreeNo sign-up

An equation of a line calculator writes the line through your data as y = mx + b. For the points (1, 3) and (4, 9), the slope is m = (9 − 3)/(4 − 1) = 2. Then b = 3 − 2 × 1 = 1, so the line is y = 2x + 1, or 2x − y = −1 in standard form.

Equation of a line: what do you know?
Point 1
Point 2
Try:
Numbers can be whole numbers, decimals or fractions such as 3/4.
Slope-intercept form
y = 2x + 1

Slope m = 2, y-intercept b = 1

The line is y = 2x + 1 with slope 2 and y-intercept 1. Point-slope form: y − 3 = 2(x − 1). Standard form: 2x − y = −1.

Slope-intercept formy = 2x + 1
Point-slope formy − 3 = 2(x − 1)
Standard form2x − y = −1
General form2x − y + 1 = 0
Slope m2
y-intercept(0, 1)
x-intercept(−1/2, 0)
Angle with the x-axis≈ 63.43°

Related lines and forms

Intercept formx/(−1/2) + y/1 = 1
Parallel lines have slope2
Perpendicular lines have slope−1/2
Directionrises from left to right
448runrise(1, 3)(4, 9)Green: the line. Open blue dots: intercepts. Gold dots: the points used. Dashed gold: rise over run.
Show steps
  1. Slope: m = (y₂ − y₁)/(x₂ − x₁) = (9 − 3)/(4 − 1) = 6/3 = 2.
  2. Point-slope form with the first point: y − 3 = 2(x − 1).
  3. Find b by putting the first point into y = mx + b: 3 = 2 × 1 + b, so b = 3 − 2 = 1.
  4. Slope-intercept form: y = 2x + 1. Check with the second point: 2 × 4 + 1 = 9 = y₂.
  5. For standard form, move the x term to the left and make the x coefficient positive: 2x − y = −1.

Check any point by putting its x into y = mx + b: you should get its y.

Equation of a Line Calculator (Free, with Graph)
Embed this calculator on your site

Free to use on class pages, blogs and course pages. Copy the code below and paste it into your page:

How to use the equation of a line calculator

  1. Pick what you know: Two points, a Point & slope, the Slope & intercept, a line to be Parallel / perpendicular to plus a point, the two Intercepts, or any equation to Convert.
  2. Enter whole numbers, decimals or fractions such as 2/3. For a vertical line, type “undefined” as the slope.
  3. Read the slope-intercept, point-slope, standard, general and intercept forms, with the slope, both intercepts and the angle the line makes with the x-axis.
  4. Check the graph (gold dashes show rise over run) and open Show steps for the full working.

The three forms of a line equation

Form Equation Best when you know
Slope-intercept y = mx + b the slope m and the y-intercept b; best for graphing
Point-slope y − y₁ = m(x − x₁) the slope and any point (x₁, y₁)
Standard Ax + By = C whole-number coefficients; finding intercepts; solving systems

In standard form, A, B and C are integers with no common factor, and A is usually made positive. Two more forms appear in the results: the general form Ax + By + C = 0, and the intercept form x/a + y/b = 1, where a and b are the x- and y-intercepts.

Every form describes the same line, so you can move between them with algebra. Starting from y = −2x + 11, add 2x to both sides to get the standard form 2x + y = 11.

Equation of a line from two points

  1. Find the slope: m = (y₂ − y₁)/(x₂ − x₁). For (1, 3) and (4, 9): m = 6/3 = 2.
  2. Put one point into y = mx + b to find b: 3 = 2(1) + b, so b = 1.
  3. Write the equation: y = 2x + 1.
  4. Check with the other point: 2(4) + 1 = 9. It works.

If both points have the same x-coordinate, the run is 0 and the slope is undefined. The line is vertical, written x = c. Through (3, −1) and (3, 6), the line is x = 3. If both points have the same y-coordinate, the slope is 0 and the line is horizontal, such as y = 4.

Equation of a line from a point and a slope

With slope −2 through (3, 5), point-slope form gives y − 5 = −2(x − 3) right away. Distribute and add 5: y = −2x + 6 + 5 = −2x + 11. In standard form, 2x + y = 11.

From the slope and the y-intercept, write the answer directly. Slope 2 and y-intercept −3 give y = 2x − 3. A line that passes through (0, 4) and rises 3 for every 1 step right has m = 3 and b = 4, so y = 3x + 4; the point (2, 10) is on it because 3(2) + 4 = 10.

Parallel and perpendicular lines

Parallel lines have equal slopes. Perpendicular lines have slopes that are negative reciprocals, so their product is −1 (flip the fraction and change the sign).

Example: the line perpendicular to y = 2x + 1 through (4, 3) has slope −1/2. Then y − 3 = −(1/2)(x − 4), so y = −(1/2)x + 5, or x + 2y = 10 in standard form. A line perpendicular to a vertical line is horizontal, and the other way round.

Given slope Parallel slope Perpendicular slope
2 2 −1/2
−3/4 −3/4 4/3
1 1 −1
0 (horizontal) 0 undefined (vertical)

Equation of a line from its intercepts

If a line crosses the x-axis at (a, 0) and the y-axis at (0, b), its intercept form is x/a + y/b = 1 and its slope is −b/a. With intercepts 3 and −6, the slope is 6/3 = 2 and the line is y = 2x − 6, or 2x − y = 6.

Common mistakes

  • Mixing the order in the slope formula: subtract y-values and x-values in the same order.
  • Sign errors in point-slope form: through (−4, 1) it is y − 1 = m(x + 4), not m(x − 4).
  • Using the reciprocal without the sign change (or the sign change without the reciprocal) for perpendicular lines.
  • Calling a vertical line’s slope 0. Vertical lines have an undefined slope; horizontal lines have slope 0.
  • Leaving fractions in standard form. Multiply through so A, B and C are whole numbers.

Equation of a Line practice quiz: 10 questions

Test yourself with 10 multiple-choice questions. Choose an answer and press Submit to see if you are right and why. Your score appears at the end.

Question 1 of 10
1. What is the equation of the line through (2, 1) and (6, 9)?

Found a mistake? Let us know!

2. A line has slope −3 and passes through (1, 4). What is its y-intercept?

Found a mistake? Let us know!

3. Which is the standard form of y = (2/3)x − 4?

Found a mistake? Let us know!

4. What is the slope of a line perpendicular to 4x + 2y = 7?

Found a mistake? Let us know!

5. Write the line parallel to y = 5x − 2 through (0, 3).

Found a mistake? Let us know!

6. What is the equation of the line through (4, −2) and (4, 7)?

Found a mistake? Let us know!

7. Which point-slope equation has slope 3/4 and passes through (−8, 1)?

Found a mistake? Let us know!

8. A line has x-intercept 5 and y-intercept −10. What is its slope?

Found a mistake? Let us know!

9. What is the x-intercept of 3x − 4y = 24?

Found a mistake? Let us know!

10. Which line is perpendicular to y = −(1/3)x + 2 and passes through (1, 1)?

Found a mistake? Let us know!

Frequently asked questions

What is the formula for finding the equation of a line?

The most used formula is y = mx + b, where m is the slope and b is the y-intercept. If you know a point instead of the intercept, start from point-slope form y − y₁ = m(x − x₁).

How do you calculate the equation of a line with two points?

Compute the slope m = (y₂ − y₁)/(x₂ − x₁), substitute one point into y = mx + b to find b, then write y = mx + b. For (1, 3) and (4, 9), m = 2 and b = 1, so y = 2x + 1.

What does it mean to find the equation of a line?

It means writing a rule that every point on the line satisfies and no other point does. For y = 2x + 1, the point (4, 9) works because 2(4) + 1 = 9, while (4, 8) does not.

How do you find the equation of a line from a slope and a point?

Substitute into y − y₁ = m(x − x₁) and simplify. With slope −2 through (3, 5), y − 5 = −2(x − 3), which becomes y = −2x + 11.

How do you find the equation of a perpendicular line?

Take the negative reciprocal of the given slope and use it with the point. Perpendicular to y = 2x + 1 through (4, 3): the slope is −1/2 and the line is y = −(1/2)x + 5.

How do you calculate the equation of a line in Excel?

Put the x-values in one column and the y-values in another, then use =SLOPE(y_range, x_range) for m and =INTERCEPT(y_range, x_range) for b. With exactly two points, this gives the line through them; with more points, it gives the best-fit line.

Related calculators

More algebra calculators

Browse all 206 calculators

Related to This Article

What people say about "Equation of a Line Calculator With Graph & Steps"?

No one replied yet.

Leave a Reply