Calculate a Line From Two Points
Enter two different coordinate pairs. Use the optional x value to calculate a matching y value.
Example Data Table
These examples show common line types and expected forms.
| Point 1 | Point 2 | Line type | Line equation |
|---|---|---|---|
| (1, 2) | (5, 10) | Oblique | y = 2x |
| (-3, 4) | (2, 4) | Horizontal | y = 4 |
| (6, -2) | (6, 8) | Vertical | x = 6 |
| (0, 0) | (4, -2) | Oblique | y = -0.5x |
Formula Used
Let the points be (x1, y1) and (x2, y2).
Slope: m = (y2 - y1) / (x2 - x1)Y-intercept: b = y1 - (m × x1)Slope-intercept form: y = mx + bStandard form: (y2 - y1)x - (x2 - x1)y + ((x2 - x1)y1 - (y2 - y1)x1) = 0Distance: d = √((x2 - x1)² + (y2 - y1)²)Midpoint: ((x1 + x2) / 2, (y1 + y2) / 2)When x2 equals x1, the line is vertical. Its equation is x equals that shared x value.
How to Use This Calculator
- Enter the x and y values for the first point.
- Enter the x and y values for the second point.
- Choose the number of decimal places to display.
- Add an optional x value to predict y on the line.
- Select Calculate Line to view equations and measurements.
- Use the CSV or PDF button to save the results.
Understanding Lines From Two Coordinates
A line is one of the simplest models in coordinate geometry. It describes a constant direction across a plane. Two different points always determine one unique straight line.
The calculator begins with Point One, written as x1 and y1. The horizontal change is called delta x. The vertical change is called delta y.
Slope measures rise compared with run. A positive slope moves upward from left to right. A negative slope moves downward from left to right. A zero slope creates a horizontal line. An undefined slope creates a vertical line. Vertical lines need special handling because division by zero is impossible.
After finding slope, the calculator determines the y-intercept. This is where the line meets the vertical axis. It also calculates the x-intercept when one exists. The x-intercept is where y becomes zero. Both intercepts help you sketch the line quickly and check the equation visually.
Several equation forms describe the same line. Slope-intercept form uses y equals mx plus b. It is convenient for graphing and predicting y values. Point-slope form keeps one original point visible. It is useful when you know a point and the slope. Standard form groups x, y, and constant terms together. It is helpful for comparisons and further algebra.
The midpoint shows the center between your two coordinates. The distance shows how far apart they are. The angle shows the direction from the first point to the second. These details are useful for paths, measurements, and vector-style work. They also provide useful checks when results seem unexpected.
A vertical line has an equation in the form x equals a constant. It does not have a finite slope or a normal slope-intercept form. A horizontal line has y equal to a constant. Its slope is zero. When both points are identical, no single line can be calculated. You need two different coordinates.
Use consistent units before entering values. A point measured in meters should not be mixed with a point measured in feet. Decimal values and negative coordinates are accepted. Choose your preferred rounding level before calculating. Then review all result forms rather than relying on one number alone.
The graph preview gives a fast visual check. The two markers should appear on the plotted line. A steep line may look nearly vertical. A very small slope may look nearly flat. Zooming or changing graph limits can improve interpretation in a separate graphing tool.
Line equations support many practical tasks. They can estimate cost growth, map motion, compare rates, or connect measured observations. They are also building blocks for linear systems and analytic geometry. Accurate input matters. Check each coordinate before using the result in a decision.
This calculator presents values in one place. It keeps special cases clear. It provides export options for records and reports. Use the result as a calculation aid, then confirm engineering, financial, or scientific work with suitable standards.
Frequently Asked Questions
1. Why are two points enough?
Two distinct points determine one unique straight line. Enter both x and y coordinates accurately. Identical points do not define a unique line.
2. What is slope?
Slope measures vertical change divided by horizontal change. It shows how quickly the line rises or falls from left to right.
3. What happens with a vertical line?
A vertical line has equal x values. Its slope is undefined because division by zero is not allowed. The equation becomes x equals a constant.
4. What happens with a horizontal line?
A horizontal line has equal y values. Its slope is zero. The equation becomes y equals a constant.
5. What is the y-intercept?
The y-intercept is the point where the line crosses the vertical axis. Its x value is always zero.
6. What is the x-intercept?
The x-intercept is the point where the line crosses the horizontal axis. Its y value is always zero.
7. Can I use negative coordinates?
Yes. Negative numbers work for either coordinate. The calculator handles points in every quadrant of the coordinate plane.
8. What does the midpoint show?
The midpoint is exactly halfway between the two entered points. It is useful for segment checks, geometry, and design measurements.
9. Why does the calculator show several equations?
Different forms suit different tasks. Slope-intercept form helps graphing. Point-slope form keeps a known point visible. Standard form helps algebraic comparison.
10. Can I calculate y for another x value?
Yes. Enter a number in the optional evaluation field. The calculator returns the matching y value for nonvertical lines.
11. Why should I save the result?
Saved results support records, homework checks, and simple reports. Two accurate points create reliable lines for every graph.