I've connected my Raspberry Pi 3 to a 7 inch display touchscreen through an HDMI cable. The problem is the display's aspect ratio doesn't match that of the screen, so there's a black bar on the right about an inch and a half wide. Moreover, if I touch the middle of the screen, it registers the touch in the middle of the display, which is slightly to the left of the touch.

I've googled this to try to solve it and they pointed me to a file called /boot/config.txt, which contains overscan settings. I tried setting overscan_right to -20, and when there was no noticeable difference, I tried the extreme value of -100000 (every source said negatives were for expanding display and positives for contracting). I tried setting overscan_left instead. I tried both possible values of disable_overscan, making sure to run sudo reboot after each change. Nothing has even made a noticeable difference.

Is there something that I'm missing? How do I get the display to fill the entire screen?

  • I've figured out the setting to change. It turns out, it's two settings called hdmi_mode and hdmi_group. But I haven't discovered my answer yet. Aug 26, 2016 at 17:06

3 Answers 3


Also, for my Raspberry Pi 4, I plugged mine into a widescreen monitor and there was a huge boarder of unused pixels, after I had used sudo rpi-update without knowing what it was for (idiot).

So, what I did was, first followed the first step and all i did was remove the # from #disable_overscan=1 in the file /boot/config.txt and then rebooted.

That did the trick!


Answering my own question (I didn't initially intend to, but I found the answer before getting one here).

As it turns out, for whatever reason, positive overscan values work just fine but negative ones don't. Anyway, I found other attributes called hdmi_mode and hdmi_group and found settings for those that made the screen too large, then used overscan to reduce the size.

There may, however, be a hdmi_mode/hdmi_group combo that's perfect for this. I just haven't found it yet.


OK lets do this step by step and get this working in 5min. Raspbian Jessie open your terminal and...

  1. sudo nano /boot/config.txt

  2. # disable_overscan=1 (leave this as it is)

  3. remove # from the following and change the values.

overscan_left=0 (Value must be a 0)

overscan_right=480 (only adjust this for right and left movement).

overscan_top=0 (value must be 0 don't try to change it)

overscan_bottom=220 (adjust this for top and bottom).

Negative values never worked and I don't know who came up with that.

  1. You then need to remove # from resolution and change it to what ever your screen is. Mine is 5" 800 x 480 for better viewing.

framebuffer_width=800 (remove the # and change to reasonable resolution)

framebuffer_height=480 (remove the # and change to reasonable resolution)

  1. MOST IMPORTANT: You need to change hdmi_mode to 4. (leave group the same don't remove the # from group or anything that I haven't).

hdmi_mode=4 (Remove the # and change to 4)

This will fill any screen from 5 inch up, after that its a case of scaling everything down to fit. You can try mode 1 , 2, 3 for smaller square screens.

ctrl o (to save)

ctrl x (to exit)

reboot and see what it looks like.

Play with scaling overscan_right and overscan_bottom to fit the screen - larger numbers condense the screen smaller numbers move the screen out. It shouldn't take more than 5 minutes to sort any screen out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.