Maths & numbers

Line segment intersection

Find a crossing point or collinear overlap between two finite segments.

Line segment intersection
Esc to restore

Your inputs

Results update as you type. Larger files run when you press Update result.

Your result

LOCAL & PRIVATE

Your result will appear here.

Your inputs stay in this browser. Nothing is uploaded or saved.

A clear answer. Here’s how.

Checks finite segments AB and CD, including point-like degenerate segments, endpoint contact and collinear overlap. Returns zero, one point, or the two endpoints of an overlapping segment. Uses length-relative geometric tolerances around 10⁻¹⁰ and clamps tiny endpoint overshoots. The segments are not extended as infinite lines. Inputs use a common Cartesian unit.

See a worked example

Worked example

A fixed demonstration, separate from the values you enter above.

A X
0
A Y
0
B X
4
B Y
4
C X
0
C Y
4
D X
4
D Y
0

Example result

Example result
PointXY
122

Point