How to rotate monitor screen 90 or 270 degrees?

Raspberry Pi Learn to Rotate Monitor Screen

Posted by Amritpal Singh on October 06, 2017

I was working on a project which required me to change Raspberry Pi’s screen to vertical rotation of the HDMI video, I was successfully able to do a horizontal (180 degrees) flip, but could not do 90 or 270 degrees screen rotations. Here is how I got it working.

Instructions on how to rotate monitor screen 90 or 270 degrees on Raspberry Pi.

Initial notes

  1. First of all, 90 or 270 degrees rotation requires more RAM memory allocated for the GPU. On Raspberry Pi RAM is split between the CPU and GPU. By default, memory assigned to GPU is 64MBytes regardless of whether you have 256MB, 512MB or 1024MB Pi. We will need to allocate more memory for the GPU in order to do a vertical screen rotation.
  2. Secondly, in the image file that I downloaded from Raspberry Pi, there was a firmware bug that caused an issue with vertical screen rotation which was later fixed. Here is a link to the bug which was mentioned on StackOverflow community: You will need to update your firmware, which is shown as step 1 in the below instructions.


  1. Go to the terminal screen, and use the below commands to update and upgrade your Raspberry Pi to get the latest firmware. This is an important step, do not skip it.
    sudo apt-get update
    sudo apt-get upgrade
  2. Instead of BIOS, Raspberry Pi uses a configuration file where you can configure various system configuration parameters, here is reference URL: We need to modify the config.txt file to specify our desired screen rotation by appending display_rotate parameter.

    display_rotate = 0 no rotation
    display_rotate = 1 rotate 90 degrees clockwise
    display_rotate = 2 rotate 180 degrees clockwise
    display_rotate = 3 rotate 270 degrees clockwise
    display_rotate = 0x10000 horizontal flip
    display_rotate = 0x20000 vertical flip

  3. Use below command edit the config.txt file:
    sudo nano /boot/config.txt
  4. Append the file specify your desired screen rotation value, e.g. 1 is for 90 degrees rotation:
  5. Next step is to allocate more memory to the GPU:
    You can do that by going into Raspberry Configuration screen or by modifying the config.txt file. To allocate 128MB (double of default value) of RAM for the GPU you can append the following line to config.txt file:
  6. Save the file and reboot your Raspberry for changes to take effect.
    That is it. Now you should have your Raspberry Pi’s HDMI video output to your selected rotation value.


Add Comment