How to use this tool
- Enter point x, point y, segment start x, segment start y, segment end x, segment end y.
- Select Calculate to view the result.
- Check the method and assumptions below before using the result.
The method, explained
Project AP onto AB and clamp the parameter t to [0,1]. Distance is from P to A+t(B−A).
Using point x = 3, point y = 4, segment start x = 0, segment start y = 0, segment end x = 2, segment end y = 0, the result is 4.12310563 units. Change these example inputs to match your task; use the method above to check each step.
Understanding your result
Unlike distance to an infinite line, the closest point can be an endpoint. A zero-length segment is treated as a point.
What to keep in mind
Unlike distance to an infinite line, the closest point can be an endpoint. A zero-length segment is treated as a point. Use the indicated units consistently. Ideal shapes are assumed; dimensions must describe the same object. Display rounding does not increase measurement precision.
Common questions
How do I use this point to line segment distance calculator?
Find the shortest distance from a point to a finite segment and locate the closest point. Enter point x, point y, segment start x, segment start y, segment end x, segment end y. The starting example is editable; use values for the same system or project.
Which assumptions affect this result?
Unlike distance to an infinite line, the closest point can be an endpoint. A zero-length segment is treated as a point.
Methodology maintained by ClarityKit. How these tools are built and checked.