Audited ·Last updated 31 Jul 2026·4 citations·Tier 2·0 uses

Intersection of Two Lines Calculator

Find where two lines cross. Enter them as y = mx + c or as Ax + By = C, and get the point, the angle between them, and a substitution check.

Intersection of Two Lines Calculator

How are your lines written?
Used only in slope-intercept mode. Any real number; a slope of 0 is a horizontal line.
Where line 1 crosses the y-axis. Used only in slope-intercept mode.
If this equals m₁ the lines are parallel and there is no single crossing point — the calculator says which of the two parallel cases you have.
Where line 2 crosses the y-axis. Used only in slope-intercept mode.
Coefficient of x in A·x + B·y = C. Used only in standard mode. A and B cannot both be zero.
Coefficient of y. Set this to 0 for a vertical line such as x = 3.
The right-hand side of line 1's equation. Used only in standard mode.
Coefficient of x in line 2. Used only in standard mode.
Coefficient of y in line 2. Set to 0 for a vertical line.
The right-hand side of line 2's equation. Used only in standard mode.
They cross at
(2, 5)
The single point both lines pass through, as an (x, y) pair. Parallel or identical lines have no single crossing point, and the calculator raises a specific error saying which case you have rather than returning a number.
x
2
y
5
Angle between the lines
71.5651°
Perpendicular
0
Determinant A₁B₂ − A₂B₁
-3
Check: A₁x + B₁y
-1
Check: A₂x + B₂y
-7

Background.

Two straight lines in a plane do one of exactly three things: they cross at a single point, they never meet, or they are the same line wearing two different equations. This calculator handles all three and, crucially, tells you which one you have rather than returning a plausible-looking number in the cases where no single answer exists. Enter y = 2x + 1 and y = −x + 7 and it returns the crossing point (2, 5), the acute angle between them, and a substitution check on each equation so you can confirm the answer without redoing the algebra.

There are two ways to type the lines in, and the choice matters more than it first appears. Slope-intercept form, y = m·x + c, is how lines are written in almost every algebra class, and it is the natural choice when you already know a slope and an intercept. But it cannot describe a vertical line: x = 3 has no slope, and forcing it into y = m·x + c requires an infinite m. Standard form, A·x + B·y = C, has no such gap — a vertical line is simply one with B = 0, and x = 3 is written 1·x + 0·y = 3. If either of your lines is vertical, switch to standard form; the calculator converts slope-intercept input into standard form internally anyway, so both modes run through the same solver and give the same answer for any line both can express.

The method is Cramer's rule, published by Gabriel Cramer in 1750 and still the fastest hand method for a two-by-two system. Write the two equations in standard form, compute the determinant A₁B₂ − A₂B₁, and the coordinates fall out as two more determinants divided by it. What makes the rule useful beyond the arithmetic is that the determinant itself is the diagnostic: it is zero precisely when the lines are parallel or identical, and non-zero precisely when a unique intersection exists. That single number decides which of the three outcomes you are in before you compute anything else.

When the determinant is zero, the calculator does not return infinity, NaN, or a blank field — it raises a specific error that distinguishes the two cases, because they are genuinely different situations rather than one failure. Parallel lines with different intercepts have no solution at all: there is no point on both. Identical lines have infinitely many solutions, since every point of the line satisfies both equations. Textbooks call these an inconsistent system and a dependent system respectively, and the distinction matters as soon as you move from two variables to three.

The angle output is the acute angle between the lines, always reported between 0° and 90°. Two crossing lines actually create two pairs of angles that sum to 180°, and quoting the acute one is the standard convention. It is computed from the two lines' normal vectors rather than from their slopes, which is a deliberate choice: the slope-based formula tan θ = |(m₂ − m₁) ⁄ (1 + m₁m₂)| breaks down at exactly the cases you most want it to handle — it divides by zero when the lines are perpendicular, and it cannot be evaluated at all for a vertical line. The normal-vector formula has no such gaps and returns exactly 90° for perpendicular lines, including a vertical-and-horizontal pair.

The two check outputs are worth using. They substitute the solved point back into each original equation, so A₁x + B₁y should reproduce C₁ and A₂x + B₂y should reproduce C₂. If either one does not, the coefficients entered are not the ones intended. Every calculation runs in arbitrary-precision decimal arithmetic and is rounded only once, at the point the answer is returned, so the checks hold exactly rather than approximately for well-conditioned input.

What is intersection of two lines calculator?

The intersection of two lines is the set of points lying on both of them, which for two distinct non-parallel lines in a plane is exactly one point. Finding it is the same problem as solving a system of two linear equations in two unknowns, because a point (x, y) lies on a line precisely when its coordinates satisfy that line's equation. The system has a unique solution when the coefficient determinant A₁B₂ − A₂B₁ is non-zero; it is inconsistent (no solution) when the determinant is zero and the lines are distinct; and it is dependent (infinitely many solutions) when the two equations describe the same line. Those three cases correspond exactly to two lines crossing, running parallel, and coinciding.

How to use this calculator.

  1. Choose the form your lines are written in. Use standard form A·x + B·y = C if either line is vertical, because slope-intercept form cannot represent one.
  2. In slope-intercept mode, enter the slope and y-intercept of each line. The six standard-form fields are ignored.
  3. In standard mode, enter A, B and C for each line. For a vertical line x = 3, that is A = 1, B = 0, C = 3. For a horizontal line y = −2, it is A = 0, B = 1, C = −2. The four slope-intercept fields are ignored.
  4. Read the crossing point at the top. If the lines are parallel or identical you will get an explicit message instead, saying which of the two it is.
  5. Confirm the answer with the two check outputs: A₁x + B₁y should equal C₁, and A₂x + B₂y should equal C₂.
  6. Read the angle if you need it. It is the acute angle, always between 0° and 90°, and it reads exactly 90° when the lines are perpendicular.

The formula.

x = (C₁B₂ − C₂B₁) ⁄ D · y = (A₁C₂ − A₂C₁) ⁄ D · D = A₁B₂ − A₂B₁ · cos θ = |A₁A₂ + B₁B₂| ⁄ (‖n₁‖‖n₂‖)

Both input forms are reduced to A·x + B·y = C before anything is solved. The conversion from slope-intercept is one rearrangement: y = m·x + c becomes m·x − y = −c, so A = m, B = −1 and C = −c. That is why one solver serves both modes, and why the answer is identical whichever mode you use for a line both can express.

Cramer's rule then solves the pair. The coefficient determinant is D = A₁B₂ − A₂B₁. Replacing the x-column with the constants gives Dₓ = C₁B₂ − C₂B₁, and replacing the y-column gives D_y = A₁C₂ − A₂C₁. When D is not zero, x = Dₓ ⁄ D and y = D_y ⁄ D. This is exactly the elimination method you would do by hand, with the bookkeeping written as determinants.

When D is zero the rule cannot be applied, and the reason is geometric rather than arithmetic: D = 0 means the two normal vectors are parallel, so the lines themselves are parallel. The system is still consistent in one sub-case — when Dₓ and D_y are also zero, the two equations are scalar multiples of one another and describe the same line, giving infinitely many solutions. Otherwise the lines are parallel and distinct, and there is no solution at all. The calculator tests exactly that and raises two different, specific errors, because reporting 'no answer' for a pair of identical lines would be wrong in a way that matters.

The determinant reported alongside the answer is the determinant of the matrix as you entered it, and its magnitude is not a property of the geometry. Scaling one equation by ten — writing 20x − 10y = −10 instead of 2x − y = −1 — describes the identical line but multiplies the determinant by ten. Only whether the determinant is zero is scale-independent, and that is the only thing the calculator uses it for.

The angle uses normal vectors deliberately. The familiar slope formula tan θ = |(m₂ − m₁) ⁄ (1 + m₁m₂)| fails in two places: the denominator is zero exactly when the lines are perpendicular, which is the case people most often want, and the formula cannot be evaluated at all when either line is vertical. Taking the angle between the normals n₁ = (A₁, B₁) and n₂ = (A₂, B₂) through cos θ = |n₁·n₂| ⁄ (‖n₁‖‖n₂‖) has neither problem. The absolute value in the numerator is what makes the result acute: without it, reversing the sign of one equation — which does not change the line — would return the supplementary angle instead. Perpendicularity is then the clean test A₁A₂ + B₁B₂ = 0, which is equivalent to m₁·m₂ = −1 when both slopes exist and remains correct when one line is vertical.

All arithmetic runs in arbitrary-precision decimal, and rounding to ten decimal places happens once, at the return boundary. Negative zero is normalised to zero so an intersection at the origin reads (0, 0) rather than (-0, -0).

A worked example.

Example

Find where y = 2x + 1 and y = −x + 7 cross. By hand, set the two right-hand sides equal: 2x + 1 = −x + 7, so 3x = 6 and x = 2. Substituting back into either equation gives y = 2(2) + 1 = 5, or equally y = −2 + 7 = 5. The crossing point is (2, 5). Now the same problem the way the calculator does it. Converting to standard form, y = 2x + 1 becomes 2x − y = −1, so A₁ = 2, B₁ = −1, C₁ = −1. And y = −x + 7 becomes −x − y = −7, so A₂ = −1, B₂ = −1, C₂ = −7. The coefficient determinant is D = A₁B₂ − A₂B₁ = 2(−1) − (−1)(−1) = −2 − 1 = −3. It is not zero, so a unique intersection exists. The x-determinant is Dₓ = C₁B₂ − C₂B₁ = (−1)(−1) − (−7)(−1) = 1 − 7 = −6, giving x = −6 ⁄ −3 = 2. The y-determinant is D_y = A₁C₂ − A₂C₁ = 2(−7) − (−1)(−1) = −14 − 1 = −15, giving y = −15 ⁄ −3 = 5. Both match the hand solution. The checks confirm it: A₁x + B₁y = 2(2) − 1(5) = −1, which is C₁, and A₂x + B₂y = −1(2) − 1(5) = −7, which is C₂. The angle comes from the normal vectors n₁ = (2, −1) and n₂ = (−1, −1). Their dot product is 2(−1) + (−1)(−1) = −1, whose absolute value is 1. The magnitudes are √5 and √2, so cos θ = 1 ⁄ √10 ≈ 0.3162277660 and θ ≈ 71.5650511771°. That agrees with the slope-based check arctan(3) = 71.5650511771°, since tan θ = |(−1 − 2) ⁄ (1 + 2(−1))| = |−3 ⁄ −1| = 3. The lines are not perpendicular, and the perpendicularity flag reads 0 because A₁A₂ + B₁B₂ = −2 + 1 = −1, not 0. One note on the determinant. Entering these same two lines in standard mode as 2x − y = −1 and x + y = 7 — the more usual way to write the second one — gives a determinant of +3 rather than −3, while the point and the angle come out identical. That is the scaling effect: the determinant's sign and size depend on how each equation happens to be written, and only its being zero or non-zero is a fact about the geometry.

intercept11
const C27
formslope-intercept
slope2-1
coef A21
slope12
coef A12
coef B21
coef B1-1
const C1-1
intercept27

Frequently asked questions.

How do you find the intersection of two lines?
Solve the two equations simultaneously — the crossing point is the one (x, y) that satisfies both. If both lines are in y = mx + c form, set the right-hand sides equal to each other, solve for x, then substitute back for y. In general, write both in A·x + B·y = C form and apply Cramer's rule: x = (C₁B₂ − C₂B₁) ⁄ D and y = (A₁C₂ − A₂C₁) ⁄ D, where D = A₁B₂ − A₂B₁. This calculator does the second version, which handles every case the first one can plus vertical lines.
What if the two lines are parallel?
Then there is no intersection point and the calculator says so explicitly rather than returning a number. Parallel lines have the same slope but different y-intercepts, which makes the determinant A₁B₂ − A₂B₁ zero while the system stays inconsistent. Textbooks call this an inconsistent system with no solution. It is a genuinely different situation from two identical lines, so the two get different error messages.
What if I enter the same line twice?
Every point on the line is an intersection, so there are infinitely many solutions and no single point to report. The calculator detects this and says the two equations describe the same line. It catches the case even when the equations look different — 2x − y = −1 and 4x − 2y = −2 are the same line, since the second is just the first multiplied by two. Textbooks call this a dependent system.
How do I enter a vertical line?
Switch to standard form and set B = 0. The line x = 3 is 1·x + 0·y = 3, so A = 1, B = 0, C = 3. You cannot enter a vertical line in slope-intercept mode at all, because a vertical line has no slope — that is precisely the gap standard form exists to close. A horizontal line works in either mode: y = −2 is a slope of 0 with intercept −2, or A = 0, B = 1, C = −2.
How is the angle between two lines calculated?
From the lines' normal vectors: cos θ = |A₁A₂ + B₁B₂| ⁄ (‖n₁‖‖n₂‖), which always gives the acute angle between 0° and 90°. The more familiar slope formula tan θ = |(m₂ − m₁) ⁄ (1 + m₁m₂)| agrees whenever both slopes exist, but it divides by zero exactly when the lines are perpendicular and cannot be used at all for a vertical line. The normal-vector version has neither problem and returns exactly 90° for perpendicular lines.
Why does the determinant change when I rewrite the same equation?
Because the determinant is computed from the coefficients you typed, and scaling an equation does not change the line it describes. Entering 2x − y = −1 gives one determinant; entering 20x − 10y = −10, which is the identical line, gives a determinant ten times larger. Only whether the determinant is zero is a fact about the geometry — that is the parallel test — and that is the only thing the calculator uses it for. The crossing point and the angle are unaffected.
When are two lines perpendicular?
When A₁A₂ + B₁B₂ = 0, which is the statement that their normal vectors are at right angles. If both lines have slopes, that condition is the familiar m₁·m₂ = −1: a slope of 2 is perpendicular to a slope of −0.5. The coefficient version also covers the case the slope version cannot, a vertical line meeting a horizontal one, which this calculator reports as perpendicular with an angle of exactly 90°.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 977 calculators remain free
  • No billing is enabled
Coming soon