How to Rotate Raspberry Pi Video Display / Screen

Updated 13 January 2018

Like many things in the Raspberry Pi ecosystem, functions such as rotating the display output can be a little unintuitive at first. Or perhaps you’re not sure how to get rid of that annoying black outline on your screen. So, we’ve put together a handy quick-reference tutorial for you. The methods used here were tested on a Pi 3, however, they’ll be applicable to any model Pi and any of the Raspberry Pi displays.

Everything that we’re doing will be done by editing the config.txt file. You can do this by viewing the contents of your micro SD card on a computer and opening the config.txt file from the boot directory in a text editor. Our preferred method though is just by editing it directly in the terminal on your Pi. It’s easier and much cleaner. To do this, open a new terminal window and enter the following:

sudo nano /boot/config.txt

Rotating the Display

You can rotate the display by using the display_rotate and lcd_rotate commands. They both rotate the display, however, lcd_rotate also rotates the touch interface. A common issue when using the Official Raspberry Pi Touchscreen is that most of the stands for it, such as the Pimoroni Touchscreen Case, mount the screen upside down. If you only used display_rotate, it would look rotated, but your touch inputs wouldn’t match up.

To rotate your display, simply enter display_rotate or lcd_rotate at the bottom of your config file:

#rotate 0 degrees
display_rotate=0
#rotate 90 degrees clockwise display_rotate=1
#rotate 180 degrees display_rotate=2
#rotate 270 degrees display_rotate=3

It’s that easy! You can also flip your display by adding the following:

#flips the display vertically
display_rotate=0x20000
#flips the display horizontally display_rotate=0x10000

Once you've made those changes, hit Ctrl+X and then Y to save, and you’ll need to reboot in order for any of those changes to take effect, so just use:

sudo reboot

Removing the Black Border

If you see a black border around your screen, then you need to adjust the underscan settings. This can be changed in the GUI config editor (available via the main menu), however, given that we’ve been working in the terminal, it’s easier just to stay there.

Look for the line #disable_overscan=1 and remove the ‘#’ symbol which changes it from a comment to a line of code. Once you reboot your system, that pesky, black border will be gone! You can always re-enable it by putting the ‘#’ symbol back in front and reboot for the change to take effect.

 Disable overscan settings

And that's all there is to it folks. As always, be sure to leave a comment if you have any questions. Happy Making!

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.