How to Rotate the Screen of the Raspberry Pi

In this guide, you will learn how to rotate the screen on the Raspberry Pi.

Raspberry Pi Rotate Screen Output

There are various cases in which you will need to rotate the display output of your Raspberry Pi.

The ability to rotate the screen output is useful is when you are using a monitor vertically, or the display is mounted upside down.

Needing to rotate the screen output of your Raspberry Pi is a task often required when dealing with cases for the official Raspberry Pi touchscreen.

Using these steps, you will be able to rotate your screen by 90 degrees, 180 degrees, and 270 degrees.

These few steps are relatively straightforward and can be completed in just a couple of minutes.

Equipment List

Here is a list of the equipment we recommend for this guide on rotating the display connected to your Raspberry Pi.

Recommended

Optional

We tested this guide on a Raspberry Pi 3 and a Raspberry Pi 4 running the latest version of Raspbian Buster.

Rotating the Screen from Desktop

In this section, we will be showing you how to use the display configuration tool on Raspbian to rotate your screen.

If you have the 3D graphics driver disabled, you will need to try the terminal method for the Raspberry Pi 3 to rotate your screen instead.

Using the Screen Configuration tool is by far the simpler way of rotating your screen for the Raspberry Pi 4.

1. To get to the Screen Configuration tool on the Raspberry Pi, you need to click the Pi icon in the top-left hand corner of the screen.

Finding the Screen Configuration tool

2. Within this menu, hover over “Preferences“.

In the side menu that pops up, clickScreen Configuration“.

Screen Configuration Tool Within Start Menu

3. With this utility opened, right-click (1.) the display you want to modify.

Hover over “Orientation” (2.), then click the way you want to rotate your display (3.).

Once you are happy with the orientation, click the green tick button. (4.).

Using the Raspberry Pi Screen Configuration Tool

4. To confirm the change, you will need to click the “OK” button within 10 seconds.

This timer is to prevent you from messing up your display settings and will automatically revert to the original settings after the 10 seconds has expired.

Confirm Screen Configuration Changes

Rotating the Screen from Terminal

In this section, we will walk you through the steps to rotating the screen using the terminal.

There are two different methods for rotating the screen.

One section is for the Raspberry Pi 4, the other method is for the other Pi’s and for those who disabled the 3D driver on the Pi 4.

Rotating the screen for the Raspberry Pi 4

Due to the new video driver used for by  the Raspberry Pi 4, you are unable to rotate the screen using the old /boot/config.txt method.

If you want to rotate the screen on a Pi 4, we recommend that you use the Screen Configuration tool as it is much simpler to use.

Instead you will need to make use of the xrandr command.

1. In the terminal of your Raspberry Pi run one of the following commands.

If you want the rotation to affect the second HDMI slot try using HDMI-2 instead of HDMI-1 in the commands below.

DISPLAY=:0 xrandr --output HDMI-1 --rotate normal

This command resets the rotation back to normal.

DISPLAY=:0 xrandr --output HDMI-1 --rotate left

The command above rotates the screen output to the left. This is the equivalent of rotating by 90 degrees.

DISPLAY=:0 xrandr --output HDMI-1 --rotate right

This line rotates the screen to the right. This command is the same as turning the screen by 270 degrees.

DISPLAY=:0 xrandr --output HDMI-1 --rotate inverted

This final command flips the screen. This behavior is the same as rotating the screen by 180 degrees.

Rotating the screen for the Raspberry Pi 3 and Earlier

1. Within the terminal on your Raspberry Pi, begin editing the boot configuration file by running the following command.

sudo nano /boot/config.txt

2. Within this file is where we will be able to change the screen rotation.

First, you have to decide how you want your screen rotated.

A number from 0 to 4 represents each of the possible rotations that the Raspberry Pi supports. A rotation of 90 degrees is  1, 180 degrees is 2, and 270 degrees is 3.

Based on how you want the display rotated, enter one of the following lines to the bottom of the file.

If you want to rotate the orientation of the LCD connection, instead you can use display_lcd_rotate instead of display_hdmi_rotate.

display_hdmi_rotate=0

This setting will reset the rotation of your Pi’s screen to normal. This setting represents the default behavior.

display_hdmi_rotate=1

Using this setting will rotate the screen by 90 degrees. This option is equivalent to rotating the screen to the right.

display_hdmi_rotate=2

With this option, you will be rotating the output of the display by 180 degrees. This is the same behavior as inverting the screen.

display_hdmi_rotate=3

Changing this option to 3 will rotate the screen by 270 degrees. This would be the same as rotating your screen to the left.

3. Once you have entered the line you want, please save the file by pressing CTRL + X, then Y, followed by ENTER.

4. For the new rotation setting to take effect, you will need to restart your Raspberry Pi.

You can restart your Raspberry Pi easily by using the command below.

sudo reboot

With that done, you should now have successfully rotated the display output of your Raspberry Pi.

If you have run into any issues with this guide, please feel free to drop a comment below.

4 Comments

  1. Avatar for Smash
    Smash on

    Still working (GUI method)!!

  2. Avatar for Dave
    Dave on

    OMG THANK YOU!! The note about the /boot/config stuff not working on RPi 4 just saved my sanity. You’re the best!!

  3. Avatar for Yva
    Yva on

    Thank you so much!!! It’s so easy to follow your instructions. Great job.

  4. Avatar for Crizco
    Crizco on

    Dude, you just made a difficult job that was not working, exceedingly easy!

    Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *