Line Equation Calculator

Build the equation of a straight line, or take an equation you already have and see it in every standard form at once: slope-intercept (y = mx + b), point-slope and standard form (Ax + By = C), with the slope, the angle, both intercepts, a table of values and a graph. Start from two points, from a slope and one point, or from a typed equation in any of those forms, and a fourth mode finds the parallel and perpendicular lines through any point. Everything is computed in exact fractions, so a slope of 2/3 stays 2/3. For slope, angle and grade on their own, the Slope Calculator goes deeper; this page is about the equations.

Coordinates and slopes can be typed as integers, decimals or fractions (3/2 is fine). Equations can be typed in any common form: y = 2x – 1, 2x + 3y = 6, y – 3 = 2(x – 1) or x = 4. A graph window of x from −8 to 8 and y from −6 to 6 is drawn; a line that misses that window is still fully described in the table.

How to use this calculator

  1. Choose what you are starting from: two points, a slope and a point, an existing equation, or the parallel/perpendicular mode.
  2. Type the values. Fractions like 3/2 work everywhere a number goes; equations are typed the way you would write them.
  3. Click Calculate and read the slope-intercept form first, then the facts table: slope, angle of inclination, both intercepts, point-slope form and standard form.
  4. Use the table of values and the graph to see the line: the table gives exact y for x = −2 to 3, and the graph draws the line with your points marked.
  5. In the parallel/perpendicular mode, type the given line as an equation and the point to pass through; both new lines come back in slope-intercept and standard form.

The method

Slope: m = (y2 − y1) / (x2 − x1). If x1 = x2 the line is vertical and the slope is undefined; its equation is x = x1.

Slope-intercept form: y = mx + b, where b = y1 − m·x1 from any point on the line.

Point-slope form: y − y1 = m(x − x1). It is the slope formula rearranged, and it turns back into slope-intercept form by expanding.

Standard form: Ax + By = C with integer coefficients, no common factor, and A positive (written here with the first nonzero coefficient positive).

Intercepts: the y-intercept is (0, b); the x-intercept is (−b/m, 0) when m is not 0. Angle of inclination: the angle the line makes with the positive x-axis, between 0° and 180°.

Parallel lines share the slope m. Perpendicular lines have slopes whose product is −1, so the perpendicular slope is −1/m (a horizontal line’s perpendicular is vertical, and the other way round).

Any typed equation is first read as A·x + B·y + C = 0 underneath: if B is not zero the line has slope −A/B and intercept −C/B; if B is zero and A is not, the line is the vertical x = −C/A; if both are zero the input is not a line at all and it is refused with the reason. Because coordinates and coefficients are held as exact fractions, converting between forms loses nothing: the three forms of the line through (2, 3) and (6, 11) are exactly y = 2x − 1, y − 3 = 2(x − 2) and 2x − y = 1, and any of them typed back in returns the same line.

Worked examples

Example 1: two points (the defaults)

Through (2, 3) and (6, 11): the slope is (11 − 3)/(6 − 2) = 2, and b = 3 − 2·2 = −1, so the line is y = 2x − 1. Point-slope form from the first point: y − 3 = 2(x − 2). Standard form: 2x − y = 1. The x-intercept is 1/2 (the point (1/2, 0)), the y-intercept is −1, the angle of inclination is 63.43°, and the two points are 4√5 ≈ 8.9443 apart with midpoint (4, 7).

Example 2: slope and a point

Slope 2 through (1, 1): b = 1 − 2·1 = −1, the same line as Example 1, y = 2x − 1, with point-slope form y − 1 = 2(x − 1). Different starting information, same line, which is the point of having every form side by side.

Example 3: converting standard form

Type 2x + 3y = 6: rearranged, y = −(2/3)x + 2. Slope −2/3, angle of inclination 146.31° (a falling line tilts past 90°), x-intercept (3, 0), y-intercept (0, 2), and the standard form comes back unchanged, 2x + 3y = 6, because it was already in lowest integer terms.

Example 4: a vertical line

Type x = 4, or give the two points (3, 1) and (3, 9) for x = 3: the x coordinates agree, so there is no slope and no y = mx + b form. The result gives the equation x = 4, standard form x = 4, x-intercept (4, 0), no y-intercept, angle 90°, and a table that varies y against the fixed x.

Example 5: parallel and perpendicular through a point

Given the line y = 2x − 1 and the point (3, 4): the parallel line keeps slope 2 and passes through the point, y = 2x − 2 (check: 2·3 − 2 = 4). The perpendicular slope is −1/2, giving y = −(1/2)x + 11/2 (check: −3/2 + 11/2 = 4). In standard form they are 2x − y = 2 and x + 2y = 11.

Example 6: fractional points

Through (1/2, 1) and (3/2, 2): the slope is (2 − 1)/(3/2 − 1/2) = 1/1 = 1, and b = 1 − 1·(1/2) = 1/2, so the line is y = x + 1/2. Fractions in, exact fractions out, nothing rounded to 0.5-style decimals in the working.

Reading your results

The three forms are one line. Slope-intercept is best for graphing and reading off values, point-slope is best when you know a point and a slope, and standard form is the convention for systems of equations and many textbooks. If two forms ever look inconsistent, expand the point-slope form: it must simplify to the slope-intercept form.

The sign of the slope is the direction. Positive slopes rise, negative slopes fall, slope 0 is horizontal, and “undefined” means vertical, not broken: vertical lines are the one case with no y = mx + b form.

Intercepts are points, not numbers. The x-intercept 1/2 in Example 1 is the point (1/2, 0), where the line crosses the x-axis; the y-intercept −1 is the point (0, −1). A horizontal line above the axis has no x-intercept, and a vertical line away from the axis has no y-intercept; the result says so instead of inventing one.

The angle of inclination runs 0° to 180°. Rising lines sit below 90°, falling lines above it (Example 3’s 146.31°), horizontal is 0° and vertical is exactly 90°.

Common mistakes

  • Mixing up the slope ratio. Slope is rise over run, (y2 − y1)/(x2 − x1). Swapping in (x2 − x1)/(y2 − y1) gives the reciprocal, a different line; pairing a y from one point with an x from the other gives nonsense. Both subtractions must run in the same point order, though either order gives the same slope as long as both match.
  • Sign slips in point-slope form. The form is y − y1 = m(x − x1): with the point (−2, 5) it is y − 5 = m(x + 2), because x − (−2) is x + 2. The result prints the signs already resolved.
  • Forcing a vertical line into y = mx + b. It cannot be done: a vertical line is not a function of x. Its equation is x = a constant, full stop.
  • Perpendicular slope by sign flip alone. Perpendicular means flip AND reciprocate: from m = 2 the perpendicular slope is −1/2, not −2. The product of the two slopes must be −1.
  • Non-integer standard form. (1/2)x + y = 3 is a correct equation but not standard form as the term is usually meant; the convention used here clears fractions and common factors, giving x + 2y = 6.

Limitations

  • Straight lines in two variables only. Curves (anything with x², roots or functions) are refused with the reason, and lines in 3D need a different description entirely.
  • The graph window is fixed at x from −8 to 8 and y from −6 to 6. A line whose intercepts sit far outside that window is reported in the table and facts instead, with a note on the graph.
  • The parallel/perpendicular mode takes the given line as a typed equation; for a line you only know by two points, run the two-points mode first and type its slope-intercept form into the parallel mode.
  • Distances use the same units as the coordinates; if your points mix units, convert them first.

Frequently asked questions

How do I find the x-intercept of a line?

Set y = 0 and solve: the x-intercept is −b/m in slope-intercept form, or −C/A from standard form. Every result on this page lists it as a point. A horizontal line other than the x-axis itself never crosses, and the result says “none” rather than guessing.

What is the equation of a vertical line through x = 4?

Just x = 4. Every point on it has x coordinate 4 and y is free, which is why no slope and no y = mx + b form exist for it. Type x = 4 into the equation mode to see its full fact sheet.

How do I convert point-slope form to slope-intercept form?

Expand the bracket and tidy up: y − 3 = 2(x − 2) becomes y − 3 = 2x − 4, then y = 2x − 1. Or type the point-slope equation into the equation mode here and read the slope-intercept form straight off the result.

What slope is perpendicular to a line with slope 3/4?

−4/3: flip the fraction and change the sign, so the two slopes multiply to −1. The parallel/perpendicular mode works it out for any line and any point.

Can the two points be in any order?

Yes. (y2 − y1)/(x2 − x1) and (y1 − y2)/(x1 − x2) are the same number, because both differences change sign together. The line, and every form of it, comes out identical either way.

What does the table of values show?

The y value of the line at x = −2, −1, 0, 1, 2, 3, computed exactly. It is the fastest way to grab points for sketching the line by hand, and for a vertical line it lists the x value against varying y instead.

Related calculators

Method: coordinates, slopes and equation coefficients are held as exact fractions; a typed equation is reduced to A·x + B·y + C = 0 by a parser that distributes brackets and refuses non-linear terms by name, then the slope, intercept and all three forms are derived from those three coefficients, with vertical lines (B = 0) carried as x = −C/A throughout. Standard form is normalized to primitive integer coefficients with the first nonzero coefficient positive. The graph is drawn by clipping the exact line to the stated window. Last reviewed: 22 October 2026.

Disclaimer: This calculator gives estimates for general information only. It is not financial, medical or other professional advice.