Graph a Line Equation: Steps, Examples, and Tips

Charts & pivot tables · Updated November 22, 2026

To graph a line equation, identify two points that satisfy it, plot them on a coordinate plane, and draw the straight line through them. If the equation is written as y = mx + b, the quickest method is to plot the y-intercept (0, b) and use the slope m to locate another point.

What a Line Graph Shows

A graph represents all the ordered pairs (x, y) that make an equation true. For a linear equation in two variables, those pairs lie along a straight line. The horizontal axis is the x-axis and the vertical axis is the y-axis; their intersection, (0, 0), is the origin. A plotted point is located by moving horizontally to its x-coordinate and then vertically to its y-coordinate.

For example, y = 2x + 1 is true when x = 0 and y = 1, so (0, 1) belongs on its graph. It is also true when x = 1 and y = 3, so (1, 3) is another point. The graph is the complete line through those points, not just the two dots. Unless the problem restricts the variables, the line continues in both directions.

Read Slope-Intercept Form

The form y = mx + b makes the two key graph features visible. The coefficient m is the slope, which describes how much y changes when x increases by one. The constant b is the y-intercept, where the line crosses the y-axis. At that crossing, x = 0, so the point is (0, b).

Slope is often described as “rise over run”: the vertical change divided by the horizontal change between two points. If m = 3/2, moving two units to the right corresponds to moving three units up. If m = -2, which can be written as -2/1, moving one unit right means moving two units down. A positive slope rises from left to right; a negative slope falls. A zero slope gives a horizontal line.

For instance, in y = -2x + 4, the y-intercept is (0, 4) and the slope is -2. From the intercept, move one unit right and two units down to reach (1, 2). Repeating that move gives (2, 0). Any two distinct points are enough to draw the line, while a third point can help check the work.

Steps for Graphing from Slope-Intercept Form

  1. Rewrite the equation as y = mx + b if possible. Identify the number multiplying x as the slope and the standalone constant as the y-intercept.
  2. Plot the y-intercept at (0, b). Include a negative sign when locating a negative value.
  3. Write the slope as a fraction if it is not already one. Treat its numerator as the rise and its denominator as the run. For a negative slope, move down when moving right, or move up when moving left.
  4. Use that rise and run to mark a second point. Keep the direction consistent with the sign of the slope.
  5. Draw a straight line through the points, extending it in both directions. Add arrowheads if the graphing instructions call for them.
  6. Check a point by substituting its coordinates into the original equation. If both sides agree, the point is on the line.

Suppose the equation is y = (1/3)x - 2. Plot (0, -2). Since the slope is 1/3, move three units right and one unit up to plot (3, -1). You could also move three units left and one unit down to reach (-3, -3). These points all lie on the same line.

Graphing Other Common Equation Forms

Not every line equation is already in slope-intercept form. In standard form, an equation is commonly written as Ax + By = C, where A, B, and C are constants. One approach is to solve for y when B is not zero, producing slope-intercept form. Another is to find the intercepts: set y = 0 to find the x-intercept, then set x = 0 to find the y-intercept. Plot the two intercepts and connect them.

For example, take 2x + y = 6. Setting x = 0 gives y = 6, so the y-intercept is (0, 6). Setting y = 0 gives 2x = 6, so x = 3 and the x-intercept is (3, 0). The line through these points is the graph. The same equation can be rearranged as y = -2x + 6, which confirms that its slope is -2.

Point-slope form, y - y₁ = m(x - x₁), gives a slope and a point on the line. Plot (x₁, y₁), then use the slope to find a second point. For y - 2 = 3(x - 1), the known point is (1, 2) and the slope is 3. Moving one unit right and three units up gives (2, 5). You may expand or rearrange the equation if that makes the intercept easier to see, but it is not necessary to graph it.

Vertical Lines and Special Cases

An equation such as x = 3 describes a vertical line: every point on it has x-coordinate 3, while y can take any value. Plot a few points such as (3, -2), (3, 0), and (3, 2), then draw the vertical line through them. A vertical line has undefined slope because calculating slope would require dividing by a horizontal change of zero. It cannot be written as y = mx + b.

An equation such as y = -2 describes a horizontal line. Every point has y-coordinate -2, so the line crosses the y-axis at (0, -2) and has slope zero. These cases matter because the usual slope-intercept procedure does not describe a vertical line, even though it is a straight line and has a perfectly valid graph.

Some equations that look more complicated still describe a line. For example, 2y = 4x + 6 becomes y = 2x + 3 after dividing both sides by 2. But an equation such as y = x² is not a line; its graph is curved. The key test is whether the variables can be rearranged into a first-degree linear relationship, rather than assuming every equation with x and y represents a straight line.

Use a Table of Values When Needed

If the equation is difficult to rearrange or you want a reliable check, make a small table. Choose convenient x-values, substitute each into the equation, calculate y, and plot the resulting ordered pairs. For y = 2x - 1, choosing x = -1, 0, 1 gives y-values of -3, -1, and 1. The corresponding points are (-1, -3), (0, -1), and (1, 1).

Choose values that keep the arithmetic manageable. If the slope is a fraction, x-values that are multiples of its denominator may produce integer y-values. A table is also useful when the graphing window does not show an intercept clearly. However, plotting many points does not replace checking the scale: points can be correct individually and still be placed inaccurately on the axes.

Choose a Scale and Check the Graph

Before plotting, decide what each grid interval represents. Many classroom grids use one unit per square, but a graph can use two, five, or another number of units per interval. Label the axes and mark the scale so that the coordinates can be read accurately. The x- and y-axes do not have to use identical scales, but the scale on each axis must be consistent. An unlabeled or uneven scale can make a correct line appear to have the wrong slope.

Check a drawn line in several ways:

  • Confirm that the plotted points have the intended coordinates and are on the marked scale.
  • Substitute at least one plotted point into the original equation, not just a rearranged version that may contain an algebra error.
  • Check whether the line rises, falls, or stays level as expected from the sign and value of its slope.
  • Verify that its y-intercept is where the line crosses the vertical axis, and its x-intercept is where it crosses the horizontal axis.

For example, if you graph y = -2x + 4, the point (2, 0) should check because substituting x = 2 gives y = -2(2) + 4 = 0. If your plotted line crosses the x-axis at a different location, review the arithmetic, point placement, or scale.

Common Mistakes and Misconceptions

A frequent error is reversing the coordinates. An ordered pair is always written (x, y): move along the x-axis first, then move vertically. Another is treating the y-intercept as (b, 0); it is (0, b), because the y-axis consists of points where x equals zero. The x-intercept, by contrast, has y equal to zero.

Negative slope can also be misread. A slope of -3/2 means a change of three units down for every two units right, not three down and two left at the same time. Moving left two and up three describes the same line in reverse. In either direction, the ratio of vertical change to horizontal change remains -3/2.

Finally, two points determine a line only if they are distinct. Plotting the same point twice gives no direction, so it cannot establish the slope. If a graphing question provides a restricted domain or asks only for part of a line, follow that instruction rather than extending the graph beyond the stated interval. In an ordinary equation with no such restriction, draw the full line.

Frequently Asked Questions

How do you graph a line if the equation is not solved for y?
Rearrange it into y = mx + b when possible, or find two points by substituting values. For standard form, setting x or y to zero often gives the intercepts directly.

Can you graph a line with only one point?
Not by itself. Infinitely many lines pass through one point. You also need a slope, a second distinct point, or another condition that identifies the line.

How do you graph a line with a negative slope?
Plot the y-intercept, then move right and down according to the slope’s fraction, or move left and up. For slope -2, for example, move one unit right and two units down.

What is the difference between an x-intercept and a y-intercept?
The x-intercept is where the line crosses the x-axis, so its y-coordinate is zero. The y-intercept is where it crosses the y-axis, so its x-coordinate is zero. A line may have either intercept at the origin.

How do you graph a vertical line?
For an equation such as x = 4, plot points whose x-coordinate is always 4, such as (4, 0) and (4, 2), and draw a vertical line through them. Its slope is undefined.

Do you need to plot more than two points?
Two distinct correct points are sufficient to determine a line. A third point is optional, but it can reveal arithmetic or plotting mistakes before you finish the graph.

Related

Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.

More in Charts & pivot tables

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.