🏆 US-Registered Digital Marketing Agency
Advertisement
Advertisement
GEOMETRY

Line Intersection Calculator — where two lines cross

Find the intersection point of two lines from slopes, general-form coefficients or two points each, and get a clear answer when they are parallel or identical.

General form is the only one that can represent a vertical line, since a vertical line has no finite slope.
Equal slopes mean the lines never meet, unless the intercepts match too, in which case they are the same line.
Intersection point
(0, 0)
 
0
x coordinate
0
y coordinate
Acute angle between lines
Relationship
Tip: two lines have exactly one intersection, none, or infinitely many. The determinant A₁B₂ − A₂B₁ decides which: non-zero gives one point, zero gives either parallel or identical lines.
Advertisement

The line intersection calculator above finds the point where two straight lines cross. It accepts three input formats — slope-intercept, general form, and two points per line — and converts all of them to a common representation before solving, which is what lets it handle vertical lines and degenerate cases without special pleading. When the lines do not cross it says which of the two reasons applies: parallel and distinct, or the same line written twice.

Arb Digital publishes this because the intersection of two lines is one of the small number of calculations that keeps reappearing across completely unrelated fields. It is the break-even point where a cost line meets a revenue line, the solution of a two-variable system, the crossing of a supply and demand curve, the collision test in a 2D game engine, and the corner point in a linear programming feasible region. The arithmetic is identical every time, and so is the failure mode when the determinant is zero.

What This Line Intersection Calculator Does

It converts both lines into the general form Ax + By = C, computes the determinant of the coefficient matrix, and solves by Cramer's rule when that determinant is non-zero. It also reports the acute angle between the lines, which is often the more useful output — perpendicularity, near-parallelism and glancing crossings all show up in that number before they show up in the coordinates. The relationship field states plainly whether the lines intersect, are parallel, are coincident, or are perpendicular.

The boundary with our other line tools is clean. Our slope calculator works on a single line through two points and returns its gradient, intercept and length — one line, no intersection. Our system of equations calculator solves larger linear systems algebraically, including three variables and more, where the geometric picture is planes rather than lines. This page is specifically the two-line, two-dimensional case, presented geometrically with the parallel and coincident outcomes treated as real answers rather than errors.

How to Use It

  1. Pick the input format that matches what you have. Converting by hand first is where mistakes creep in, so let the tool do it.
  2. Use general form for vertical lines. A vertical line has undefined slope and cannot be written as y = mx + b, but 1x + 0y = 4 expresses x = 4 perfectly well.
  3. Enter points in any order. The line through two points does not depend on which you call first, and the tool normalises the coefficients internally.
  4. Read the relationship field before the coordinates. If it says parallel or coincident, the coordinates are not meaningful and the tool will not invent any.
  5. Check the angle for near-parallel lines. An angle below about a degree means the intersection point is extremely sensitive to small changes in the inputs.

The Formula and How It's Calculated

Both lines are written as A₁x + B₁y = C₁ and A₂x + B₂y = C₂. The determinant of the coefficient matrix is D = A₁B₂ − A₂B₁. When D is non-zero the solution comes straight from Cramer's rule: x = (C₁B₂ − C₂B₁) ÷ D and y = (A₁C₂ − A₂C₁) ÷ D. Converting the other input forms is mechanical: y = mx + b becomes −mx + 1y = b, and a line through (x₁, y₁) and (x₂, y₂) becomes (y₂ − y₁)x − (x₂ − x₁)y = (y₂ − y₁)x₁ − (x₂ − x₁)y₁.

Work the default through. Line 1 is y = 2x + 1, so A₁ = −2, B₁ = 1, C₁ = 1. Line 2 is y = −0.5x + 6, so A₂ = 0.5, B₂ = 1, C₂ = 6. The determinant is (−2)(1) − (0.5)(1) = −2.5. Then x = (1×1 − 6×1) ÷ (−2.5) = (−5) ÷ (−2.5) = 2, and y = ((−2)(6) − (0.5)(1)) ÷ (−2.5) = (−12.5) ÷ (−2.5) = 5. The lines meet at (2, 5). Substituting back confirms it: 2(2) + 1 = 5 and −0.5(2) + 6 = 5.

The angle uses direction vectors. For Ax + By = C the direction is (B, −A), so the acute angle between the lines is arccos of the absolute value of the dot product divided by the product of the magnitudes. Here the directions are (1, 2) and (1, −0.5); their dot product is 1 − 1 = 0, so the angle is exactly 90° and the lines are perpendicular. That matches the slope test, since m₁ × m₂ = 2 × (−0.5) = −1. Paul's Online Notes at Lamar University covers the same forms of the equation of a line and the parallel and perpendicular relationships that this conversion relies on.

Advertisement

When the Determinant Is Zero: Two Very Different Answers

A zero determinant means the lines have the same direction, but that covers two completely different situations and lumping them together is a real error. If the lines are parallel and distinct there is no solution at all — the system is inconsistent, and no pair of coordinates satisfies both equations. If the lines are the same line written two different ways, every point on it is a solution, and the system is dependent with infinitely many.

The test that separates them is whether the constants scale by the same factor as the coefficients. If A₂ = kA₁ and B₂ = kB₁ but C₂ ≠ kC₁, the lines are parallel. If C₂ = kC₁ as well, they are identical. Concretely: 2x + 4y = 6 and x + 2y = 3 are the same line, while 2x + 4y = 6 and x + 2y = 5 never meet. Lamar University's notes on linear systems with two variables use exactly this inconsistent-versus-dependent distinction. Our determinant calculator evaluates the same quantity for larger matrices, where it plays the identical role of deciding whether a unique solution exists.

Near-Parallel Lines and Numerical Sensitivity

The interesting failures are not the exactly-parallel cases, which the tool catches, but the almost-parallel ones, which it solves quite happily while producing an answer nobody should trust. As the determinant approaches zero, the intersection point runs off toward infinity, and a small change in any input coefficient moves it enormously.

Try it. The lines y = 1.000x and y = 1.001x + 1 meet at x = −1000. Change the second slope to 1.002 and the intersection jumps to x = −500. A change of one part in a thousand in an input halved the answer. If your coefficients come from measurements with any error at all, a near-zero determinant means the intersection is not determined by your data, no matter how many decimal places the calculation returns. This is what "ill-conditioned" means in numerical linear algebra, and the acute-angle field is the practical warning light: below roughly one degree, treat the coordinates as indicative rather than exact.

Lines Versus Segments: the Distinction That Breaks Collision Code

This calculator intersects infinite lines. That is the correct mathematical object for solving a system of equations, but it is not what most practical problems mean. A break-even analysis over a twelve-month horizon, a road crossing between two junctions, or a collision test between two moving objects are all questions about segments — finite pieces of those lines — and two segments can lie on lines that intersect at a point neither segment contains.

The extra step is a range check. Parameterise each segment as P + t(Q − P) with t running from 0 to 1, solve for both parameters, and require that both fall inside [0, 1]. If either lands outside, the infinite lines cross but the segments do not. Forgetting this check is the classic bug in 2D collision detection, and it also quietly invalidates break-even analyses that extrapolate a cost line far beyond the volume range the cost data actually covers. The intersection is real; it just sits somewhere your problem does not reach.

Reading the Angle Between the Lines

The angle field reports the acute angle, between 0° and 90°, because two crossing lines always form two pairs of angles that sum to 180° and quoting the acute one removes the ambiguity. Zero means parallel. Ninety means perpendicular, which for two non-vertical lines is equivalent to their slopes multiplying to −1.

The slope-product test is worth knowing but also worth distrusting, because it fails silently in the vertical case: a vertical and a horizontal line are obviously perpendicular, yet one has no slope at all so the product cannot be formed. The direction-vector calculation this tool uses has no such gap, which is one of the practical reasons general form is preferred in computational geometry. For related coordinate work, our linear interpolation calculator finds intermediate values along a single line, and our quadratic equation solver handles the curved case where a line meets a parabola.

Need your break-even and growth curves modelled properly?

Arb Digital builds the reporting layer that shows where your cost and revenue lines actually cross, using your own numbers.

Explore Web Growth Talk To Our Team

Common Mistakes to Avoid

  • Trying to write a vertical line as y = mx + b — it has no finite slope, so it needs general form, where B is simply set to zero.
  • Treating parallel and coincident as the same outcome — one has no solutions and the other has infinitely many, and they mean opposite things in an applied problem.
  • Trusting an intersection from near-parallel lines — when the determinant is close to zero, tiny changes in the inputs move the answer by huge amounts.
  • Confusing lines with segments — infinite lines may cross at a point that lies outside both of the finite pieces you actually care about.
  • Using the slope-product perpendicularity test on a vertical line — the product cannot be formed, so the test reports nothing rather than reporting perpendicular.

Related Free Tools From Arb Digital

Work with a single line using the slope calculator, solve larger systems with the system of equations calculator, test for a unique solution with the determinant calculator, estimate between two known points with the linear interpolation calculator, or handle curves with the quadratic equation solver. Everything we publish is listed on the free online tools hub.

Frequently Asked Questions

How do you find where two lines intersect?

Write both in the form Ax + By = C, compute the determinant A₁B₂ minus A₂B₁, and if it is not zero apply Cramer's rule. The x coordinate is (C₁B₂ minus C₂B₁) over the determinant and the y coordinate is (A₁C₂ minus A₂C₁) over it.

What happens when the determinant is zero?

The lines share a direction. If the constant terms scale by the same factor as the coefficients, the two equations describe the same line and every point on it is a solution. If not, the lines are parallel and never meet.

Can this handle a vertical line?

Yes, in general form. A vertical line has no finite slope, so it cannot be written as y = mx + b, but 1x + 0y = 4 represents the line x = 4 without any difficulty.

How do I know if two lines are perpendicular?

Their acute angle is 90 degrees. For two non-vertical lines this is the same as their slopes multiplying to minus one, but the angle test also works when one of the lines is vertical.

Do line segments intersect wherever their lines do?

No. Two segments can lie on lines that cross at a point outside one or both segments. Checking segments requires parameterising each from 0 to 1 and confirming both parameters land inside that range.

Why is my intersection point so far away?

Because the lines are nearly parallel. As the determinant approaches zero the crossing point moves toward infinity, and the answer becomes extremely sensitive to small changes in the coefficients.

Does the order of the two points on a line matter?

No. Swapping them negates all three coefficients of the general form, which describes the same line, so the intersection and the angle are unchanged.

This page explains a geometric calculation for educational purposes. Results assume exact input coefficients, and any answer derived from measured or estimated values should be checked for sensitivity before it is relied on.

Advertisement
Advertisement

Take it further