Custom Resolutions in VirtualBox

If you are like the growing number of people who have a widescreen desktop or laptop, being able to modify the default resolutions in VirtualBox is very handy.  This post tells you how.

First of all, start up VirtualBox.  Don’t start your virtual machine though.

Next we need to open up a terminal window and run VBoxManage.  The syntax of the VBoxManage command is as follows:

VBoxManage setextradata [VM Name] CustomVideoMode[num] [width]x[height]x[color depth]

Where [VM Name] is the name of your virtual machine (as displayed in the VirtualBox console).
Where [num] is the number of the resolution you want to add (you can add many virtual resolutions).
Where [width] and [height] are the resolution of your screen.
Where [color depth] is the color depth of your screen.  For example 32 bits.

In my case, I wanted to adjust the screen resolution to 1152 x 680 to fit nicely in a window on my Macbook (which has a native resolution of 1280×800 and color depth of 32).  So the command I ran was:

VBoxManage setextradata Windows CustomVideoMode1 1152x680x32

Once you have run the above command, you can start your virtual machine and change the resolution to the one you set above.

If you don’t know what resolution you want, there’s a good Wikipedia page that lists common screen resolutions:

Additional screen resolutions

Note the 1 on the end of CustomVideoMode.  You can actually increment this value to add more resolutions to the virtual machine.  For example, if I wanted to connect my laptop to a HD cinema display and run 1080p resolution, I may run the following command:

VBoxManage setextradata Windows CustomVideoMode2 1920x1080x32

Note the 2 on the end of CustomVideoMode.

What happens if it fails?

Some older versions of VirtualBox need a different command.  If the above command doesn’t work, try this command instead.  (Warning: I have not tested this as I don’t have an old copy).

The syntax is:

VBoxManage controlvm [VM Name] setvideomodehint [width] [height] [color depth]

So using my example above, I would run the following command:

VBoxManage controlvm Windows setvideomodehint 1152 680 32