How to Remove Black Border From Raspberry Pi Display

display with black border

One problem I often have when setting up a new Raspberry Pi on a display, is that the display doesn’t stretch to the entire area of the screen. Rather, there is a black border between the content on the screen and the display’s bezel. So annoying!

The following is what fixed the problem for me on multiple Raspberry Pi’s and displays. I’m using the latest (as of this post) Raspbian Stretch October 2018 version. If on a different version, the solution might be slightly different, but hopefully it works for you.

To get rid of the black border, we have to edit the config.txt file in the /boot directory.

To do that, open the terminal or SSH into your Pi.

In the terminal, type the following command:

sudo nano /boot/config.txt

This will open the config.txt file in nano, a simple text editor that runs in the terminal.

The file is about 60 lines of text or so. Use the Up/Down Left/Right buttons on your keyboard to navigate the document in nano.

Find the following line:


Now remove the # in front of the command so it reads:


Anything with a hashtag in front of it is treated as a comment, meaning the computer ignores it. So by uncommenting the line (removing the hashtag), the computer will execute the command.

Type Ctrl+x on your keyboard to exit nano, and a little message at the bottom or the terminal will say, “save modified buffer?’.

Type y for ‘yes’.

Then the file name appears at the bottom of the screen. Don’t change it and hit Enter on the keyboard to save your changes.

This will save the file, and exit nano back into the terminal.

Now all you have to do is reboot your Pi.

Type the following into your terminal:

sudo reboot now

And hit Enter.

Your Pi should reboot without the annoying black border.