How to Rotate the Raspberry Pi Display Output


If you are building a Raspberry Project with screen there may be times you need to rotate the screen. This fairly easy to do in Raspbian.

Step 1 – Edit Config.txt

Start by editing the config.txt file :

sudo nano /boot/config.txt

Add one of the following lines to the bottom of the file :


0 is the normal configuration. 1 is 90 degrees. 2 is 180 degress. 3 is 270 degrees.

If you are using the Official Raspberry Pi touch screen you can use “lcd_rotate” rather than “display_rotate”.

Save the file by using CTRL-X, Y then ENTER.

Step 2 – Reboot

Then reboot using :

sudo reboot

When the Pi restarts the display should be rotated.

I used this technique in my Retro Arcade Table project where the monitor was mounted up-side-down in order to improve the viewing angle. The monitor looked much better when viewed from the top and being able to rotate the screen was a massive improvement.



  1. Had the same isue with my arcade table, when you put the monitor up side down. the view angle is the same as you would stand in front of it, better contrast .

  2. Thank you for your instructions!

    The display also rotates correctly with “display_rotate = 3” because my screen hangs on the wall in portrait format
    but the desktop is no longer displayed only “Welcom to the Raspberry Pi Dersktop”

    What can I do?

  3. Rushikesh Bute on

    I have rotated the screen using ‘display_rotate ‘ as my 7″ screen is unofficial. But now the touch axis is not working properly. please guide me on this issue.

  4. For non official HDMI touchscreen (7″ 1024×600):

    – Rotate display:
    sudo nano /boot/config.txt
    Add at the end:
    hdmi_cvt 1024 600 60 3 0 0 0

    – Rotate touchscreen:

    Edit cd /usr/share/X11/xorg.conf.d/40-libinput.conf (or similar file *libinput*)
    Search the Section with one line called “libinput touchscreen catchall”
    In this section add:
    90° = Option “TransformationMatrix” “0 -1 1 1 0 0 0 0 1”
    180° = Option “TransformationMatrix” “-1 0 1 0 -1 1 0 0 1”
    270° = Option “TransformationMatrix” “0 1 0 -1 0 1 0 0 1”

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.