Line through two points
Enter two points and get the equation of the line in slope intercept and standard form, with the steps, the slope, the distance, the midpoint, the parallel, the perpendicular and the graph.
Decimals accept a dot or a comma, and fractions written with a slash work too, for example 3/2 or -7/4.
How to use it
Type the coordinates of A and B and the answer appears at once, with nothing to press. Decimals accept a dot or a comma and fractions written with a slash work too, like 3/2 or -7/4. Every step runs on exact fractions, so 1/3 stays 1/3 instead of turning into 0.3333 and the equation you read is the one your teacher expects on paper. The two checkboxes add the parallel and the perpendicular through a point P, and the intersection with a second line.
Where the equation comes from
The slope is m = (yB - yA) / (xB - xA), that is how much the line climbs every time you move 1 to the right. From there the point slope form y - yA = m(x - xA) expands into y = mx + q with q = yA - m·xA. The same line also has a standard form ax + by + c = 0, shown here with a, b, c integers having no common factor, and a symmetric form (x - xA)/(xB - xA) = (y - yA)/(yB - yA), which only holds when neither denominator is zero.
The case that costs marks
If A and B share the same x the line is vertical: the slope does not exist, it is not infinity, and y = mx + q simply cannot describe it. The only possible equation is x = k, and the page shows exactly that instead of dividing by zero. If the two points are identical there is no line to find, because infinitely many lines pass through a single point, and you get a message rather than an invented answer.
Parallel and perpendicular
Two lines are parallel when they share the slope and perpendicular when m1·m2 = -1. That rule breaks in the two limit cases. The perpendicular to a horizontal line (m = 0) is vertical and has no slope, the perpendicular to a vertical line is horizontal with m = 0, so both are handled separately here. For the intersection with the second line the system is solved and the determinant a1b2 - a2b1 decides: when it is zero the lines are parallel, and they are the same line when the constant terms match as well.
Graph and stated limits
The picture uses the same scale on both axes, so a right angle really looks like one and the perpendicular never looks crooked; the window follows the points and includes the origin only when that does not squash the drawing. Fields accept up to 12 integer digits and 10 decimals and report an error beyond that instead of rounding behind your back. In the distance the radical is simplified by pulling out squares of numbers up to 1000, so with a huge radicand only the decimal form is left, itself rounded to four digits. Everything runs in your browser and nothing is sent to a server.