Distance Formula Calculator
Find exact straight-line lengths.
Dimensions
Number line, plane or space
Arithmetic
Exact squared distances
Units
Seventeen physical conversions
Distance inputs
Measure the direct segment exactly.
Signed decimal, scientific e notation or integer fraction.
Coordinate and display options
Inactive sources are retained locally and excluded from calculation and sharing.
Signed decimal, scientific e notation or integer fraction.
Signed decimal, scientific e notation or integer fraction.
Signed decimal, scientific e notation or integer fraction.
Changing this unit reinterprets all entered coordinates; it does not rescale their numbers.
Converts the result using an exact length multiplier. Squared distances use its square.
Exact coordinates and radicals remain unchanged. Very large or tiny nonzero values use at least six significant scientific digits.
Sources support sixty significant decimal digits or sixty digits per integer fraction, one hundred eighty characters, and scientific input exponents from negative one hundred through positive one hundred. Exact numerators and denominators are bounded to eighteen hundred digits. Root rounding uses exact integer comparisons and half-away-from-zero ties. Large radicals retain a verified exact expression without promising complete square-free factorization. Diagram positions are numerical approximations.
Exact straight-line distance
Rounded distance view
Coordinate subtraction and squaring stay exact. The nonnegative radical squares back to the output squared distance with zero residual. The decimal view does not replace that exact answer.
Distance in the coordinate unit
The coordinate-unit length and chosen output length describe the same physical segment when physical units are selected.
This is straight-line Euclidean distance in Cartesian coordinates with compatible axis units, not route length, geographic distance or a signed displacement. Changing the coordinate unit reinterprets the entered numbers; changing the output unit converts the result.
Segment and right-triangle diagram
Square: first endpoint. Diamond: second endpoint. Solid line: direct distance. Dashed legs: coordinate displacements. An axis-aligned segment has a zero leg and no right-angle marker.
Axes outside this local window are omitted. Centering uses exact coordinate differences before numerical plotting; components below screen resolution can appear aligned. The exact coordinates determine the answer.
Distance calculation step by step
Record the source points
Use one Cartesian reference frame and one common coordinate unit. Every selected coordinate axis contributes; unit choices label these source numbers rather than rescaling them.
Subtract the horizontal coordinates
Subtract in the same endpoint order on every active axis. A signed component is a displacement, not the nonnegative straight-line length.
Subtract the vertical coordinates
Subtract in the same endpoint order on every active axis. A signed component is a displacement, not the nonnegative straight-line length.
Square and add the active displacements
Each squared contribution is nonnegative. In one dimension this reduces to an absolute coordinate difference; in three dimensions the depth contribution is included.
Take the nonnegative square root
The exact radical defines the length. Common small square factors and perfect-square remainders are extracted with bounded work; exceptionally large radicals are not claimed to be completely square-free.
Convert the length and verify the radical
The length multiplier acts once on distance, and its square acts on squared distance. An exact algebraic certificate squares the resulting radical and must reproduce the output squared distance without rounding.
Inputs saved with this calculation
- Coordinate dimensions
- 2 Cartesian dimensions
- Active source points
- First endpoint: horizontal 1, vertical 2; Second endpoint: horizontal 4, vertical 6
- Common coordinate unit
- Centimeters
- Output distance unit
- Centimeters
- Rounded decimal places
- 6
- Show diagram
- true
- Show conversions
- true
All result details
The full record preserves original coordinates, signed displacements, individual squared contributions, coordinate and output squared distances, the length multiplier and exact radical residual. A squared length and a length have different dimensions; their unit conversion powers differ.
| Quantity | Exact value | Rounded decimal | Interpretation |
|---|---|---|---|
| First endpoint horizontal coordinate | Exact source coordinate in the common coordinate unit. | ||
| First endpoint vertical coordinate | Exact source coordinate in the common coordinate unit. | ||
| Second endpoint horizontal coordinate | Exact source coordinate in the common coordinate unit. | ||
| Second endpoint vertical coordinate | Exact source coordinate in the common coordinate unit. | ||
| Signed horizontal displacement | Second endpoint coordinate minus first endpoint coordinate; endpoint reversal changes the sign. | ||
| Signed vertical displacement | Second endpoint coordinate minus first endpoint coordinate; endpoint reversal changes the sign. | ||
| Horizontal squared contribution | Square of the matching coordinate displacement; never negative. | ||
| Vertical squared contribution | Square of the matching coordinate displacement; never negative. | ||
| Coordinate squared distance | Sum of every active squared coordinate displacement. | ||
| Length conversion multiplier | Exact output length units per coordinate length unit; apply once to length and twice to squared length. | ||
| Output squared distance | Coordinate squared distance multiplied by the square of the length conversion multiplier. | ||
| Exact radical verification | Square of the exact radical minus output squared distance; exactly zero. |
Distance in all physical units
All seventeen supported physical conversions use exact ratios. Feet and miles are international definitions; points and picas use the typographic inch definitions stated in the selector. Hidden conversions remain in CSV.
| Unit | Exact length | Rounded length |
|---|---|---|
| Nanometers | ||
| Micrometers | ||
| Millimeters | ||
| Centimeters | ||
| Decimeters | ||
| Meters | ||
| Decameters | ||
| Hectometers | ||
| Kilometers | ||
| Mils (one thousandth inch) | ||
| Inches | ||
| International feet | ||
| International yards | ||
| International miles | ||
| International nautical miles | ||
| Typographic points (one seventy-second inch) | ||
| Typographic picas (one sixth inch) |
Dimensions
Number line, plane or space
Arithmetic
Exact squared distances
Units
Seventeen physical conversions
Measure direct segments and understand every squared contribution
Exact lengths between Cartesian points
Enter endpoints on a number line, in a plane or in space. The calculator preserves signed finite decimal and integer-fraction sources while subtracting corresponding coordinates exactly. It records every displacement and squared contribution before constructing the nonnegative radical length. This makes the result useful when nearby large coordinates would otherwise lose their separation through an early conversion to floating-point numbers.
Physical conversions with the right dimensions
Choose a common physical coordinate unit and a separate output unit, or explicitly use unitless coordinates. The length and squared-length records use different conversion powers, with exact rational factors for all seventeen physical units. Feet and miles follow international definitions, while typographic points and picas use their stated inch relationships. Hidden conversion rows remain available in the complete CSV export.
Inspectable geometric and algebraic evidence
A planar diagram separates the finite direct segment from its perpendicular coordinate legs, uses equal units and distinguishes both endpoints with different marker shapes. Exact subtraction and squaring steps explain the displayed length. A radical certificate must reproduce the output squared distance exactly. Coincident and axis-aligned cases have truthful degenerate diagrams, and space calculations retain every active coordinate without pretending to be planar.
Distance formulas and step-by-step examples
Build a direct planar length from perpendicular changes
For and , the displacements are and . Square both changes and add their nonnegative contributions. The coordinate squared distance is , while the nonnegative distance is . These are different quantities with different physical dimensions when a length unit is assigned.
Retain fractions before taking the root
With and , the exact displacements are and . Their squared sum is , giving a distance of . The decimal view is useful for reading, but rounding either coordinate first would change the defined problem and the squared-distance verification.
Add the depth contribution in space
For and , the displacement is . Every active coordinate must contribute. The squared distance is and the exact length can be written . A planar picture would omit depth and therefore describe a different segment length.
Convert squared lengths with the squared multiplier
The default segment has length . Converting to meters uses a length multiplier of . The squared distance is therefore multiplied by , not . Keeping both records makes the dimensional change inspectable, and converting back recovers the original exact length.
Handle number-line and zero-length cases consistently
On a number line, and have distance . Reversing them changes the signed difference but preserves its absolute value. Identical endpoints have distance in every supported dimension. They need no special invented direction or nonzero triangle; the single shared diagram marker explains the geometry directly.
Why use an exact coordinate-distance workflow?
Preserve the defined problem
- Finite decimal and integer-fraction sources retain their exact rational meaning through every active coordinate subtraction.
- Nearby large coordinates preserve small exact separations; rounded endpoint views do not replace the stated sources.
- Invalid, missing and unsupported inputs remain explicit errors instead of being silently turned into zero.
- The table and CSV retain the original coordinates, units, component differences and complete squared-distance checks.
Separate length from its presentation
- The nonnegative radical is verified against the output squared distance with an exact algebraic certificate.
- Integer square-root comparisons control decimal rounding, including exact ties; scientific formatting preserves tiny nonzero lengths.
- Physical lengths use exact ratios, while squared lengths use the square of the selected length conversion factor.
- The equal-unit planar diagram is a numerical screen illustration; exact table values remain authoritative at tiny scales.
Useful for coordinate geometry, teaching and model checks
Learners applying the Pythagorean theorem
Connect endpoint coordinates to a right triangle through the signed horizontal and vertical differences. Squaring removes component signs without hiding the original direction. Compare a familiar integer-length example with an irrational or fractional example, then extend the same sum of squares to space. The step-by-step record explains why adding coordinate differences directly does not generally produce a straight-line length.
Teachers preparing checked worked solutions
Use the exact result, contribution table and finite diagram to build a reproducible solution. Endpoint swapping demonstrates distance symmetry while reversing component signs. Coincident and axis-aligned examples expose valid boundary cases. Share the active sources for another reader, or print the mathematical working with its input record. CSV keeps all digits when unusually large numerical expressions exceed a readable printed line.
Design and technical coordinate comparisons
Check direct separations inside a Cartesian model whose axes use compatible physical units. Compare the source-unit length with a chosen output unit and inspect the squared conversion power. This is a numerical model check rather than a measurement-validation service. Geographic positions, road routes, curved surfaces, historical survey definitions and anisotropic coordinate scales require their own transformations or distance models before this Euclidean calculation applies.
How it works in three quick steps.
Choose dimensions and enter both endpoints
Select a number line, plane or space. Enter matching coordinates as signed finite decimals, scientific notation or integer fractions. Use one Cartesian reference frame and one common coordinate unit. Choose unitless when no physical coordinate scale is specified. Inactive coordinate fields retain their local source strings but do not contribute to the lower-dimensional calculation or its shared link.
Inspect exact displacements and the distance
Read each signed coordinate difference and its nonnegative squared contribution. Their exact sum is the coordinate squared distance. The calculator takes its nonnegative square root, preserves a certified exact radical and separately rounds a decimal view. An output-unit selection converts the length with an exact ratio; its square converts squared distance. The planar diagram distinguishes the direct segment from perpendicular coordinate legs.
Review the working and retain the complete record
Follow the subtraction, squaring, summation, square-root and unit-conversion steps. The radical verification must be exactly zero. Swap endpoints to check length symmetry while observing the displacement sign reversal. Copy the complete summary, share the active sources, download every physical conversion as CSV or print the typeset calculation. Choose Save as PDF in the browser for a portable record of the inputs and working.
Keep the source coordinates, unit choices and complete working
Download a complete exact CSV
The CSV contains active source coordinates, signed differences, squared contributions, both squared-distance records, the exact radical certificate and all seventeen physical conversions when physical units are selected. Hiding the visual conversion table does not remove those values from the export. Full source strings and method notes retain the chosen coordinate scale and help explain the result when it is reused outside this page.
Print the calculation or save a PDF
Print removes editing controls and keeps the answer, coordinate-unit length, available diagram, ordered mathematical working, input record and complete result tables. Choose a suitable page orientation and Save as PDF through the browser print dialog. Long tables can continue with repeated headers. Exceptionally long numerical expressions use an explicit compact notice pointing to CSV, rather than silently clipping exact digits at a page edge.
Share or copy a reproducible problem
Share calculation copies an editable URL fragment containing active coordinates, dimension count, coordinate and output units, precision and display choices. Hidden coordinate axes are excluded, and malformed, duplicate or extra imported fields are rejected. Copy summary retains plain-text exact radicals and every conversion without raw typesetting commands. Local dimension switches retain inactive source fields so you can revisit the previous editor state without reconstructing its coordinates.
Frequently Asked Questions
How does the distance formula work?
Can I calculate distance on a number line or in space?
Can coordinates be fractions, negative numbers or scientific notation?
What is the difference between distance and displacement?
How are physical units and squared units converted?
Which feet, miles, points and picas are used?
Does the exact radical always simplify completely?
What happens with identical points or an axis-aligned segment?
How accurate are the decimal result and diagram?
Is this suitable for geographic coordinates, sharing and printing?
About this exact Cartesian distance formula calculator
This distance formula calculator measures the nonnegative straight-line separation between two points in a common Cartesian reference frame. Each selected coordinate contributes its signed endpoint difference, then its squared difference. The sum of those contributions defines the squared length, and its nonnegative square root defines the distance. A number-line calculation uses one coordinate, the plane uses two, and space uses three. The tool keeps those dimensional choices explicit rather than treating a space example as a planar projection.
The implementation separates mathematical meaning from display. Finite decimal and integer-fraction sources retain exact rational values through subtraction, squaring and unit conversion. A verified radical certificate establishes the exact output length, while a separate integer square-root comparison determines rounded decimal views. Bounded radical reduction extracts common square factors without promising complete factorization of arbitrary large integers. The diagram illustrates a finite planar segment and its perpendicular displacement legs with equal coordinate units, but exact table values remain authoritative when screen resolution cannot distinguish tiny components.
Physical-unit handling is part of the defined problem. Changing the common coordinate-unit selector relabels the entered numbers; choosing a different output unit converts the resulting length. Squared lengths use the square of that conversion factor, and unitless coordinates are never assigned invented physical conversions. International customary definitions and the stated typographic inch conventions are preserved as exact ratios. This tool does not transform geographic coordinates, validate a survey or find route lengths. Sharing, copying, CSV and print carry the source coordinates, dimensions, units and methodology alongside the result so another reader can evaluate the same calculation.
Who maintains this page
Ownership and review
Written and maintained by the Toolarithm editorial team. No review date is shown without a maintained editorial record. No independent professional review is claimed.
Methodology
Equations are checked by substituting worked examples into the stated relationship and comparing the result with the interactive implementation.
Read the editorial methodologyDates and sources
Review dates change only after a substantive method or content check.
Keep building