Updated: 09/15/2017 by Computer Hope

When referring to a two and three-dimensional plane, a y-axis or vertical axis refers to the vertical height of a two or three-dimensional object. In the illustration, the y-axis plane moves up and down and intersects with the x-axis and z-axis.

A good example of what uses the y-axis is a computer mouse. As the mouse moves up or down the y-axis value increases and decreases, which allows the computer to know where the mouse cursor is on the screen.

JavaScript y-axis mouse position

Below is a JavaScript that shows you the mouse's x-axis and y-axis position as you move your mouse pointer in the screen area.


If you are on a smartphone or tablet, the example below will not work because a mouse is not used on those devices.

Mouse x-axis position.
Mouse y-axis position.

Other examples of a y-axis

Below are a few other examples of how the y-axis is used on a computer.

  • Help position and keep track of the mouse cursor on the screen.
  • A character or another object in a computer game that moves up and down on the screen has a y-axis value that determines its location on the screen.
  • With a chart, the y-axis is the data expressed vertically. The higher a data point is represented vertically, generally, the greater the value of the data which corresponds with that point on the x-axis.
  • In computer graphics, if you wanted to draw a vertical line the y-axis can be used to determine the start and end point of the line. Drawing a two-dimensional object would require only the x-axis and y-axis. However, a 3D object would require a z-axis.
  • Other input devices like a joystick also use a y-axis to control objects such as a tank or airplane.

Axis, x-axis, z-axis