Skip to content
ToolSuite

Coordinate Geometry Calculator

Distance, midpoint, slope, the equation of the line, section formula and triangle area from coordinates - each with the formula worked out.

Processed in your browser

Your result will appear here as soon as you add some input.

How to use it

  1. 1Enter your values in the fields above.
  2. 2The answer and the working appear immediately below.
  3. 3Check the working to see the formula with your numbers substituted.

Example

Input

A(1, 2) and B(4, 6)

Output

Distance 5, midpoint (2.5, 4), slope 1.3333, line y = 1.3333x + 0.6667

A 3-4-5 right triangle: the horizontal gap is 3, the vertical gap is 4, so the distance is exactly 5.

Formulas used

  • Distance: d = sqrt((x2 - x1)^2 + (y2 - y1)^2)
  • Midpoint: M = ((x1 + x2) / 2, (y1 + y2) / 2)
  • Slope: m = (y2 - y1) / (x2 - x1)
  • Section (internal): P = ((m*x2 + n*x1) / (m + n), (m*y2 + n*y1) / (m + n))
  • Triangle area: A = |x1(y2 - y3) + x2(y3 - y1) + x3(y1 - y2)| / 2

About the Coordinate Geometry Calculator

Coordinate geometry - analytic geometry - describes shapes using numbers instead of construction. Once two points have coordinates, every question about the line through them becomes arithmetic.

The distance formula is the Pythagorean theorem applied to the horizontal and vertical gaps between the points: the segment is the hypotenuse of a right-angled triangle whose other two sides are parallel to the axes. That is why the formula squares both differences and takes a square root.

The midpoint is simply the average of the two x values and the average of the two y values. There is no square root because you are not measuring a length, only finding the value halfway between two numbers on each axis.

The slope is rise over run: how much y changes for each unit that x changes. When the two points share an x value the run is zero, so the slope is undefined rather than infinite - the line is vertical and has the equation x = constant.

The section formula generalises the midpoint. Instead of splitting the segment in half, it finds the point that divides it in the ratio m:n. Setting m = n = 1 gives the midpoint back.

With a third point, the shoelace formula gives the area of the triangle directly from the six coordinates. An area of zero means the three points are collinear - they lie on one straight line - which is the standard way to test collinearity without computing two slopes.

Questions people ask

What is the distance between two coordinates?

It is the square root of the sum of the squared differences: sqrt((x2-x1)^2 + (y2-y1)^2). For A(1,2) and B(4,6) that is sqrt(3^2 + 4^2) = sqrt(25) = 5. The tool shows each substitution.

Why is the slope undefined for a vertical line?

Slope is the change in y divided by the change in x. On a vertical line the change in x is zero, and dividing by zero is undefined - not infinite. Such a line is written x = a constant instead of y = mx + c.

Does it work with negative coordinates and decimals?

Yes. All four quadrants and any decimal values are handled, and the working shows the signs so you can check the subtraction.

How do I check whether three points are collinear?

Enter the optional third point. If the triangle area comes out as zero, the three points lie on one straight line. That test is more reliable than comparing slopes, which breaks down when one of the lines is vertical.

Is your figures uploaded to a server?

No. This tool runs entirely in your browser using standard web APIs, so your figures never leaves your device. You can confirm it by opening your browser's network panel while the tool runs, or by disconnecting from the internet after the page has loaded.

Is it free, and do I need an account?

Yes, it is free, and there is no account, no sign-up and no watermark on the result. The project is funded by optional donations.