The distance formula calculates the straight-line length between any two points on a coordinate plane. It is derived directly from Pythagoras's theorem: the horizontal difference between the two points and the vertical difference form the two legs of a right triangle, and the direct distance is the hypotenuse. Written out, the formula is d = the square root of (x2 minus x1) squared plus (y2 minus y1) squared. This calculator takes four inputs, the x and y coordinates of each point, and returns five results in one go. The primary output is the straight-line distance between the points. You also get the midpoint, which is the point exactly halfway along the line segment, found by averaging each pair of coordinates. The slope of the line through the two points is the rise divided by the run: (y2 minus y1) divided by (x2 minus x1). From the slope and one point the calculator derives the y-intercept and writes out the full equation of the line in slope-intercept form, y = mx + b. Vertical lines, where x1 equals x2, have an undefined slope and no y-intercept form, and the calculator flags that case. The default example uses points (1, 2) and (4, 6), which give a distance of 5, a midpoint at (2.5, 4), and a slope of 1.33. This tool suits students studying coordinate geometry, map readers working with grid references, and anyone who needs to find the distance between two known locations on a scaled diagram. Results are for reference only.
The calculator reads the four coordinate inputs and applies the distance formula: d = √((x2−x1)² + (y2−y1)²). The midpoint is ((x1+x2)/2, (y1+y2)/2). The slope is m = (y2−y1)/(x2−x1). The y-intercept is b = y1 − m×x1. If x1 equals x2, the line is vertical; the slope is undefined and no slope-intercept equation exists.
Point 1 = (1, 2) and Point 2 = (4, 6) (the default values). Distance = √((4−1)² + (6−2)²) = √(9+16) = √25 = 5.00. Midpoint = ((1+4)/2, (2+6)/2) = (2.5, 4). Slope = (6−2)/(4−1) = 4/3 = 1.33. Y-intercept = 2 − 1.33×1 = 0.67. Line equation: y = 1.33x + 0.67.
If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.
Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.
Calculate.co.nz is the sister site of CalculatorHub.com, the world's largest calculator website by tool count.
All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.
Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.
Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.
Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.
All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.
About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use
Reviewed and maintained. Last reviewed 2026-07-02 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.
© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.