Find the equation of a straight line in slope-intercept form (y = mx + b), point-slope form, and standard form. Enter two points, or give a point and a slope. The calculator shows full step-by-step working.
A straight line in a two-dimensional plane is described completely by its slope (gradient) and any one point through which it passes. From these two pieces of information, you can express the line in any standard form. The three most common forms are:
| Form | Equation | When to use |
|---|---|---|
| Slope-intercept | y = mx + b | When you know or need the slope and y-intercept directly |
| Point-slope | y - y1 = m(x - x1) | When you have a specific point and the slope, before finding b |
| Standard form | Ax + By = C | For comparing lines, or when integer coefficients are preferred |
Given two points (x1, y1) and (x2, y2), follow these steps:
Example: points (1, 3) and (4, 9). Slope = (9 - 3) / (4 - 1) = 2. Y-intercept = 3 - 2 * 1 = 1. Equation: y = 2x + 1.
Vertical lines: When two points share the same x-coordinate, the slope is undefined (division by zero). The line is expressed as x = constant, for example x = 3. Vertical lines have no y-intercept unless they pass through the origin.
Horizontal lines: When two points share the same y-coordinate, the slope is 0. The equation is simply y = b, where b is the shared y-value. For example, through (2, 5) and (7, 5): y = 5.
Starting from slope-intercept form y = mx + b, you can convert to standard form by moving all terms to one side: mx - y = -b. To ensure the coefficient of x is positive, multiply through by -1 if needed: -mx + y = b, or equivalently Ax + By = C.
To convert from standard form Ax + By = C back to slope-intercept, solve for y: y = (-A/B)x + C/B.
The x-intercept is the point where the line crosses the x-axis (where y = 0). Set y = 0 in the slope-intercept equation: 0 = mx + b, so x = -b/m. For y = 2x + 1, the x-intercept is x = -1/2 = -0.5.
Sources and method: Coordinate geometry: slope formula m = (y2 - y1) / (x2 - x1); slope-intercept form y = mx + b; point-slope form y - y1 = m(x - x1); standard form Ax + By = C. Standard algebra textbook derivations.
This calculator works with real numbers. Results are rounded to 6 significant figures for display. For lines expressed as fractions, the exact decimal approximation is shown. Vertical lines (undefined slope) are noted but cannot be expressed in slope-intercept or point-slope form.
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.