Enter two points in one coordinate system
Supply the x and y coordinates of the first point, followed by the x and y coordinates of the second point. Each ordered pair describes one location in a Cartesian plane. Negative values and decimal coordinates are valid when they describe your problem. Keep the same origin, axis directions, and coordinate convention for both points. If one point comes from a drawing in inches and the other from a drawing in centimeters, convert them into a common system before entering them. The two points must be distinct. Repeating exactly the same point leaves infinitely many possible lines through that location, so the calculator cannot choose one unique equation. The point order affects the signs of the reported coefficients, but reversing both points together preserves the geometric line.
Read the output as an implicit equation
The output consists of three coefficients, not three coordinates. Insert them into Ax + By + C = 0, keeping each sign. For example, A = −4, B = 3, and C = 0 give −4x + 3y = 0. A point lies on this line if its coordinates make the left side zero. This form is called implicit because it states a relationship between x and y without isolating either variable. It handles ordinary sloping lines, horizontal lines, and vertical lines within the same expression. At least one of A and B must be nonzero for a valid line. The calculator's distinct-point requirement guarantees that mathematically. A = B = C = 0 would describe an identity satisfied by every point, which does not select a line.
How the three coefficients are calculated
For points (x1, y1) and (x2, y2), set A = y1 − y2 and B = x2 − x1. These differences produce coefficients perpendicular to the displacement between the points. Set C = x1y2 − x2y1 to place the line through the selected locations. You can verify the construction by substituting x1 and y1: (y1 − y2)x1 + (x2 − x1)y1 + x1y2 − x2y1 simplifies to zero because the products cancel in pairs. The same happens for x2 and y2. This algebra is why the method works without a separate slope division. It also explains why a vertical line is supported. A zero difference in x makes B zero rather than forcing a division by that difference.
Work through the default points
The default points are (0, 0) and (3, 4). The coefficients are A = 0 − 4 = −4, B = 3 − 0 = 3, and C = 0 × 4 − 3 × 0 = 0. The equation is −4x + 3y = 0. Substituting the first point gives zero immediately. Substituting the second gives −4 × 3 + 3 × 4 = −12 + 12 = 0. Rearranging produces y = 4x/3, so the slope is 4/3 and the line passes through the origin. These checks connect the coefficient form with a familiar graph. Do not read the coefficient A alone as the slope. In this output convention, the slope is −A/B when B is nonzero.
A second example with a nonzero constant
Take points (1, 2) and (4, 8). The calculator returns A = −6, B = 3, and C = 0 because these points also lie on a line through the origin, y = 2x. For an example with a nonzero constant, use (1, 3) and (4, 9). Then A = −6, B = 3, and C = −3, giving −6x + 3y − 3 = 0. Dividing every term by 3 gives −2x + y − 1 = 0, or y = 2x + 1. Substitution confirms both points: −6 + 9 − 3 = 0 and −24 + 27 − 3 = 0. A nonzero C shifts the line relative to the origin; it is part of the equation and must remain attached when copying the result.
Why other tools can return different-looking coefficients
Multiplying all three coefficients by the same nonzero number preserves the equation's solution set. Thus −6x + 3y − 3 = 0, −2x + y − 1 = 0, and 2x − y + 1 = 0 describe the same line. One tool may divide integer coefficients by a common factor, while another may choose a positive first coefficient. This calculator returns the coefficients constructed from the input points without promising that particular normalization. Compare complete equations rather than isolated coefficient values. If the first point and second point are exchanged, A, B, and C all change sign. That is another equivalent equation. A discrepancy in one coefficient alone, with the other two unchanged, generally cannot be dismissed as normalization and deserves a substitution check.
Vertical lines need no infinite slope
For (2, 1) and (2, 7), both x coordinates are 2. The coefficients are A = −6, B = 0, and C = 12. The equation −6x + 12 = 0 simplifies to x = 2. There is no y term because every y coordinate on that vertical line is allowed. Its slope is undefined, but its implicit equation is fully usable. Trying to divide by B to obtain y = mx + b would fail here because B is zero. Leave the result in implicit form or simplify it to x = 2. For a horizontal example, (1, 5) and (4, 5) give A = 0, B = 3, and C = −15, which simplifies to y = 5. The same coefficient method covers both cases.
Convert to slope-intercept form when possible
When B is nonzero, solve Ax + By + C = 0 for y. Subtract Ax and C from both sides, then divide by B to obtain y = (−A/B)x − C/B. The slope is therefore m = −A/B and the y-intercept is b = −C/B. This rearrangement is useful when graphing or comparing two lines by slope. It does not require rerunning the two-point calculation. For the equation −6x + 3y − 3 = 0, m is 2 and b is 1. Keep the negative signs in both ratios; using A/B instead would reverse the slope. If B is very small compared with the other coefficients, the slope can be large, so retain enough numerical precision during the division.
Find intercepts and check a plotted point
The x-intercept occurs where y is zero. If A is nonzero, it is x = −C/A. The y-intercept occurs where x is zero, and when B is nonzero it is y = −C/B. For y = 2x + 1, the intercepts are (−0.5, 0) and (0, 1). A line through the origin can have both intercepts at that same point. Vertical and horizontal lines require reading the corresponding special case rather than dividing by zero. To test any other point, substitute its coordinates into the original implicit equation. For example, (2, 5) lies on −6x + 3y − 3 = 0 because −12 + 15 − 3 = 0. This is a more reliable membership test than judging a small plotted image by eye.
A line extends beyond the two input points
The equation describes the entire infinite straight line through the points. It does not limit x and y to the finite segment between them. For the points (1, 3) and (4, 9), the point (10, 21) also satisfies the line equation, although it lies beyond the second endpoint. If your question concerns only the segment, you need an additional restriction on position between the endpoints. A convenient description is P(t) = P1 + t(P2 − P1) for 0 ≤ t ≤ 1. Values outside that interval remain on the line but outside the segment. The coordinate distance calculator gives the segment length, while the midpoint calculator identifies its halfway point.
Rounding, close points, and finite arithmetic
Substitution with exact small integers should cancel exactly in ordinary cases. Decimal coordinates can leave a tiny numerical residual when evaluated with floating-point arithmetic. Compare that residual with the scale of the terms rather than demanding an identical printed string. Two points that are extremely close together can also be sensitive to rounding in the source coordinates. If rounding makes them identical, no unique direction remains. Very large coordinates can cause products in C to overflow even when a sketch looks simple. A reported numerical error is not a valid equation and should not be replaced with guessed coefficients. Keep the original coordinate precision during calculation, and round a final equation only when the reduced precision remains adequate for the intended graph or comparison.
Locate a point between the endpoints
For points (1, 3) and (4, 9), the displacement from first to second is (3, 6). A position one third of the way along the segment is therefore (1 + 3/3, 3 + 6/3) = (2, 5). It satisfies the equation −6x + 3y − 3 = 0. This provides an additional check using a point that was not entered into the form. The halfway position is (2.5, 6), which also satisfies the equation. A parameter value of two would give (7, 15), still on the line but beyond the second endpoint. Such checks help distinguish a correct infinite line from the bounded portion intended by a diagram. For decimal coordinates, substitute into the unrounded coefficients before judging a rounded equation. Suppose a small coefficient has been rounded to zero for display: that can change the line into a horizontal or vertical one and alter its meaning. Keep enough significant digits to preserve the relationship. If the task requires an exact symbolic equation from fractions, retain those fractions in a separate algebraic calculation rather than treating an approximate decimal output as an exact proof. The present tool performs a numerical calculation from the entered coordinates.
Use the equation within its stated geometry
This method constructs a straight line in a Cartesian plane. It does not fit a regression trend to a collection of observations, determine a curved path, or compute a great-circle route from latitude and longitude. A line through two measured observations passes through those observations by construction; that alone provides no evidence that other observations follow the same relationship. If x and y represent physical variables, their unit conventions remain part of the equation. Changing the unit of one axis changes the numerical coefficients and slope. Record those conventions with the two original points when saving the result. For spatial coordinates with an additional z component, use a three-dimensional line description rather than dropping that coordinate and treating the projection as the complete geometry.