Key Points
- A horizontal line keeps the same y-coordinate at every point, so on a graph it is parallel to the x-axis.
- Its equation is , where is the height. There is no in it.
- Its slope is , a real number. The vertical line is the one with an undefined slope.
- The horizontal line test uses these lines to check whether a function is one-to-one.
The Flattest Line on the Graph, and Why That Matters
Lay a spirit level on a shelf: when the bubble sits dead centre, the shelf is level.
- Draw that shelf side-on on a grid and you get a horizontal line: it never climbs and never dips, however far it runs.
- That flatness decides everything else. It fixes the equation, forces the slope to be , and turns the line into a tool for testing functions.
- See why a flat line behaves this way, and the equation and slope stop being facts to memorise.

What Is a Horizontal Line?
A horizontal line is a straight line on which every point has the same y-coordinate.
- Moving along it changes your left-right position (the x-coordinate) but never your height (the y-coordinate).
- On a coordinate plane, "horizontal" means parallel to the x-axis. The x-axis itself is the horizontal line at height .
- In the real world, horizontal means level: at right angles to a hanging plumb line.
- The name comes from horizon, the flat line where land seems to meet sky.
The Equation of a Horizontal Line
Because the height never changes, the equation names that height and nothing else:
- is a constant: the height of the line. The line holds , , and every other point at height 2.
- There is no , because is free: any x-value will do.
- To write the equation you need one thing, the y-coordinate of any point. Through , it is .
- It crosses the y-axis at and never meets the x-axis, unless .
Our page on the equation of a line parallel to the x-axis derives the same equation from the general form of a line.
The Slope of a Horizontal Line
The slope of a line measures how much it rises for each step across, and a horizontal line never rises, so its slope is .
Way 1: rise over run
Take any two points on the line, and :
- The rise is always , and the run is never because the points are different.
Way 2: the angle with the x-axis
- Slope equals , where is the angle with the positive x-axis.
- As a line flattens, , then , then .

Zero is a slope; undefined is not
This is the most confused point on the topic.
- , because : the division has an answer.
- has no answer, because no number times gives .
- A horizontal line divides zero by something: slope . A vertical line divides something by zero: its slope is undefined.

- So "zero slope" (flat) and "no slope" (upright) mean opposite things.
Try It Yourself
Try it yourself: drag both blue handles to the same height, such as and , and the slope reads . Drag both orange handles to the same x and the slope reads "undefined". Nudge one blue handle up and the flat line tilts.
How to Draw a Horizontal Line
Drawing one is quick, because it depends only on the height .
- Find from the equation , or from the y-coordinate of a given point.
- Mark on the y-axis.
- Mark one more point at the same height, such as .
- Join them with a ruler and extend the line both ways. Every point you pass shares the y-coordinate .
A Horizontal Line Is a Constant Function
Read as a function, : whatever you feed in, the output is .
- That makes it a constant function, and its graph is the horizontal line at height 3.
- Domain: every real number. Range: just .
- Each x gives one output, so every vertical line meets it once: it passes the vertical line test.
- Its rate of change is , which is the slope again in other words.

The Horizontal Line Test
The same flatness gives a horizontal line a second job: checking whether a function is one-to-one, meaning different inputs always give different outputs.
- The test: if any horizontal line meets the graph more than once, two inputs share an output, so the function is not one-to-one.
- fails: the line meets it at and .
- passes: meets it only at .
- Any slanted straight line, like , passes, because each height is reached once.

- Only a one-to-one function can be run backwards, so this test decides whether a function has an inverse.
- Keep the two tests apart: the vertical test asks "is it a function?", the horizontal test asks "is it one-to-one?"
Horizontal Line vs Vertical Line
A horizontal line is easiest to pin down beside its opposite.
| Horizontal line | Vertical line | |
|---|---|---|
| Direction | left to right | up and down |
| Equation | ||
| Slope | undefined | |
| Parallel to | the x-axis | the y-axis |
| Crosses | the y-axis at | the x-axis at |
| A function? | yes, a constant function | no |
- The missing letter names the direction: no means horizontal, no means vertical.
- The two always meet at a right angle, at .
- The "slopes multiply to " test for perpendicular lines cannot confirm this pair, because the vertical line has no slope to multiply.
Examples of the Horizontal Line
These build from naming a line to using it to measure a shape.
Example 1
Describe the line : its direction, slope and intercepts.
- It is horizontal, at height 4, so its slope is .
- It crosses the y-axis at and never meets the x-axis.
Final answer: horizontal, slope 0, y-intercept , no x-intercept.
Example 2
Find the slope of the line through and .
- The working gives . The zero on top looks like trouble, and it is tempting to write "undefined".
- Check that: asks what number times 5 gives 0. The answer is plainly 0.
- The points share a y-coordinate, so the line is .
Final answer: slope .
Example 3
Write the equation of the horizontal line through .
- The height is the y-coordinate, .
Final answer: .
Example 4
Is the line through and horizontal? Write its equation.
- Both points have y-coordinate 1.5, so the rise is .
- Check: .
Final answer: yes, .
Example 5
Use the horizontal line test to decide whether is one-to-one.
- Draw . It meets the graph where , so or .
- One horizontal line, two meeting points: .
- Cut the graph down to and the restricted function is one-to-one.
Final answer: not one-to-one.
Example 6
Find the area of the rectangle enclosed by , , and .
- Height: the gap between the horizontal lines, .
- Width: the gap between the vertical lines, .
- Area .

Final answer: 20 square units.
Where Horizontal Lines Show Up
On any graph, a horizontal stretch says one thing: the quantity on the vertical axis is not changing.
- Heating curves. Heat ice steadily and its temperature graph goes flat at Β°C while it melts and at Β°C (at sea level) while it boils. The heat changes the state, not the temperature.
- Objects at rest. On a positionβtime graph, a horizontal line means the object is standing still.
- Equilibrium. A flat stretch on a temperatureβtime graph marks a system neither heating nor cooling.
- Control limits. Factory charts draw upper and lower limits as horizontal lines; a reading outside them flags a problem.
- Building. A spirit level, a mason's string line and a surveyor's level set out the horizontal lines everything else is measured from.

Writing a level line as goes back to RenΓ© Descartes, whose 1637 work joined algebra to geometry.
Tripping Points to Avoid
Four slips catch most students on this topic.
Mistake 1: Calling a zero slope "undefined"
Where it slips in: The calculation produces and the zero looks suspicious.
Don't do this: Write "undefined" whenever a appears in the slope fraction.
The correct way: Look at where the zero is. Zero on top: slope , horizontal. Zero on the bottom: undefined, vertical. Check by multiplication, not memory.
Mistake 2: Writing x = k for a horizontal line
Where it slips in: Asked for the horizontal line at height 4.
Don't do this: Write out of habit.
The correct way: A horizontal line fixes the height, and height is : the equation is .
Mistake 3: Mixing up the two line tests
Where it slips in: A question asks whether is one-to-one.
Don't do this: Run the vertical line test, see it pass, and answer "yes".
The correct way: The vertical test only shows it is a function. One-to-one needs the horizontal test, which fails.
Mistake 4: Saying a horizontal line has "no slope"
Where it slips in: Describing a flat line in words.
Don't do this: Say it has "no slope", which is everyday shorthand for undefined (vertical).
The correct way: A horizontal line has a slope, and it is . Zero is flat; undefined is upright.
Key Takeaways
- A horizontal line keeps one fixed height, so its equation is , with no .
- Its slope is : rise 0 over any run. Undefined slope belongs to vertical lines.
- It is the graph of a constant function, .
- It tests other functions: one horizontal line meeting a graph twice means the function is not one-to-one.
Practice These Problems to Solidify Your Understanding
Work these, then check the answers.
- Write the equation of the horizontal line through .
- Is horizontal, vertical or neither, and what is its slope?
- Find the slope of the line through and .
- Use the horizontal line test on .
- Find where meets .
- Answer to Question 1: .
- Answer to Question 2: horizontal, slope 0.
- Answer to Question 3: . Tempted by "undefined"? Reread the zero-versus-undefined part.
- Answer to Question 4: not one-to-one, since meets it at and .
- Answer to Question 5: .
To practise lines and slopes with a teacher, explore Bhanzu's geometry tutor or math classes online.
Want a live Bhanzu trainer to walk your child through lines, slopes and the line tests? Book a free demo class.
Read More
- Equation of Line Parallel to Y Axis
- Y Intercept
- Gradient Definition
- Parallel and Perpendicular Lines
Research Behind This Article
- OpenStax, College Algebra 2e, Section 3.7: Inverse Functions (the horizontal line test). openstax.org
- OpenStax, Chemistry 2e, Section 10.3: Phase Transitions (heating curves and constant temperature during melting and boiling). openstax.org
- MacTutor History of Mathematics, University of St Andrews, RenΓ© Descartes. mathshistory.st-andrews.ac.uk
- OpenStax, Elementary Algebra 2e, Section 4.4: Understand Slope of a Line (every horizontal line has slope 0). openstax.org
- OpenStax, College Physics 2e, Section 2.8: Graphical Analysis of One-Dimensional Motion (the slope of a positionβtime graph is the velocity). openstax.org
Quick Quiz: Check Yourself
Three levels, questions with figures, instant feedback with the reason.
Was this article helpful?
Your feedback helps us write better content
Frequently Asked Questions
Is the x-axis a horizontal line?
Why is the slope of a horizontal line 0 and not undefined?
Can a horizontal line have an x-intercept?
Is a horizontal line a function?
What is the difference between the horizontal line test and the vertical line test?
