ratio.

Find a tool

Browse all tools and categories ↗
GEOMETRY

Point to Line Segment Distance Calculator

Project a point onto a finite line segment, find its nearest point and compare the infinite-line distance.

Enter your values

01 / INPUT
Calculated on your device

YOUR CALCULATION

Result

—

Calculation steps

Work through one step at a time or reveal the complete calculation. The steps use your current inputs.

    How to calculate

    Project the point displacement onto the segment direction. Restrict the projection parameter to zero through one to find the nearest point on the finite segment.

    t=((P−A)·(B−A))/|B−A|²; closest=A+clamp(t,0,1)(B−A)

    Worked example

    A=(0,0), B=(4,0), P=(6,3) has infinite-line foot (6,0), but the nearest segment point is B=(4,0); segment distance is √13.

    Assumptions and input details

    Two-dimensional Cartesian coordinates with a common length unit; magnitudes up to 1e9. Endpoints must differ. The unbounded line and finite segment are intentionally reported separately. Near-coincident endpoints can amplify floating-point errors. A plotted connection is schematic if x and y screen scales differ; numeric distances use the actual coordinates.

    Using this calculator

    Can I enter my own problem?

    Yes. Replace the example values with your own inputs. The result, calculation steps, tables and applicable diagrams update from those inputs. Blank or invalid values clear the result; example values are never silently substituted for missing inputs.

    Are the results exact?

    Results use floating-point arithmetic and displayed rounding. Read the formula, assumptions and any stated data precision before interpreting the result.

    Is my input uploaded?

    The calculation runs in your browser. No account, file upload or external AI service is required. Inputs are not saved between page reloads.

    RELATED TOOL · GEOMETRYCoordinate Distance Calculator

    Enter two Cartesian points to find their distance, midpoint, coordinate changes and direction. Choose a shared input unit and compare output lengths.

    RELATED TOOL · GEOMETRYCircle and Line Intersection Calculator

    Find whether a circle and an infinite line meet in zero, one or two points. Compare the center-to-line distance, projection foot and intersection coordinates with a diagram.

    RELATED TOOL · GEOMETRYScale Calculator

    Find real length, drawing length or a scale ratio. Mix length units and compare linear, area and volume scale factors with a size diagram.

    ADVERTISEMENT

    Reserved advertising space.