Use xrandr to set a screen resolution

From time to time I see posts on various Linux forums asking how to set a screen resolution.

Often this results in a discussion about writing a configuration file, xorg.conf ( /etc/X11/xorg.conf )

While there is nothing wrong with writing a xorg.conf, xorg.conf is depreciated and writing an xorg.conf is intimidating to many users.

Using xrandr is potentially faster and easier.

How to use xrandr

First display a list of your monitor resolutions

xrandr -q

Note: If you do not see the resolution you desire listed, either your monitor does not support that particular resolution or you may need to install a driver (ati, intel, or nvidia are the big 3). The technical details of installing these drivers varies by graphics card and will not be covered in this blog.

Then set the resolution you want to use (change the “1400×1050” to your desired resolution).

xrandr -s 1400x1050

Adjusting the dpi (dots per inch)

dpi refers to the resolution of your monitor (pixels per inch) and affects window decorations, window size, and font. See this page for additional information.

On many monitors xrandr will set the dpi automatically. When it does not, or if you prefer an alternate setting, you can try specifying a dpi manually.

xrandr --dpi 96 -s 1400x1050

If that fails, you can specify a dpi in ~/.Xdefaults

Open any editor and enter the following configuration:

Xft.dpi: 96

This dpi will then be applied to any new windows you open. Alternately you can log off and back on (no need to reboot).

If 96 is not the right size for your, try a smaller ( 72 ) or larger ( 135 ) value.

Dual monitors

To use xrandr to configure dual monitors, use the --right-of or --left-of options.

Example, using a nvidia card:

First list your monitors with xrandr, note the monitor names (in bold).

bodhi@zenix:~$ xrandr -q
Screen 0: minimum 320 x 200, current 1920 x 1200, maximum 4096 x 4096
DVI-I-1 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 520mm x 320mm
1920×1200 60.0*+
1600×1200 60.0
1680×1050 60.0
1280×1024 75.0
1280×960 60.0
1152×864 75.0
1024×768 75.1 70.1 60.0
832×624 74.6
800×600 72.2 75.0 60.3 56.2
640×480 72.8 75.0 60.0
720×400 70.1
DVI-I-2 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 520mm x 320mm
1920×1200 60.0*+
1600×1200 60.0
1680×1050 60.0
1280×1024 75.0
1280×960 60.0
1152×864 75.0
1024×768 75.1 70.1 60.0
832×624 74.6
800×600 72.2 75.0 60.3 56.2
640×480 72.8 75.0 60.0
720×400 70.1
TV-1 disconnected (normal left inverted right x axis y axis)

Use xrandr to configure the monitors. Change the names “DVI-I-1” and “DVI-I-2” to the names of your monitors. You may also need to adjust the resolution and change “--left-of to” “--right-of”

xrandr --auto --output DVI-I-2 --mode 1920x1200 --left-of DVI-I-1

Has the same effect as

xrandr --auto --output DVI-I-1 --mode 1920x1200 --right-of DVI-I-2

Set a primary display

To set a primary display, use the --primary option.

xrandr --auto --output DVI-I-1 --mode 1920x1200 --primary --right-of DVI-I-2

Configuring xrandr to run when you log in

The method to do this varies by desktop and with most major desktop environments (gnome, kde, xfce) you would add the xrandr command to your start up options / applications.

With openbox, add the xrandr command to ~/.config/openbox/

With fluxbox, use ~/.fluxbox/startup

Alternately, depending on your window manager, you can add the xrandr command to ~/.xinit

For a link on using ~/.xinit, see this fluxbox wiki page or, as an alternate, the Arch wiki Slim page.

Graphical tools

I am aware of 3 5 (thanks to charlie-tca and KenP) graphical font ends for xranadr : lxrandr , grandr, the grandr applet, ARandR, and Krandr.

lxrandr is a part of the lxde and is lightweight and fast, but does not have all of the xrandr options available.

grandr has more a few more options, including rotation, but again not all the xrandr options are available from the graphical interface.

grandr applet is a small application (gnome applet) that would run in your panel and similar to lxrandr allows one to set a resolution.

Krandr is a KDE applet to set your resolution.

arandr is similar to grandr, but IMO the interface seems less intuitive. Arandr will write a script for you to set your resolution at login.

For additional information on using xrandr, see the xrandr man page.

This entry was posted in Linux. Bookmark the permalink.

31 Responses to Use xrandr to set a screen resolution

  1. Charlie Kravetz (charlie-tca) says:

    A great and timely article. Thanks so much for explaining this clearly. I would like to know if arandr fits into this anywhere. I see it mentioned often when using Xfce. To the best of my own knowledge, it is another front end for xrandr.

  2. Pingback: The Purple Suit · Multiple Screen Madness

  3. Ma says:

    Another possibility:
    Your monitor claims not to support that resolution but is a liar.

  4. bodhi.zazen says:

    @ Ma – LOL , I have not seen that , although I have seen poor linux support for some graphics cards (*cough* GMA500 *cough*).

    @ Charlie Kravetz – Yes, thank you for pointing out arandr as another graphical front end. I took it for a spin and personally prefer the other tools as they are more intuitive (IMO) and arandr does not offer anything grandr does not.

    Of the tools, lxrandr is my favorite, nice and light weight, will do the basics. All the graphical tools lack many of the xrandr options if you need more then the basics.

  5. KenP says:

    Not to leave out KDE, there is an excellent applet called KrandrTray which allows changing resolution of monitor(s) from the system tray. Also, xrandr functionality, relative position and resolution etc, is built into System Settings.


  6. bodhi.zazen says:

    @ KenP : Thank you for adding that, I will update my page ;)

  7. Pingback: Ubuntu 11.10 双螢幕 輸出設定 ATI Radeon HD 3450 | jerry-yang work's logs

  8. Ikem says:

    The links to krandr and arandr are broken.

  9. Ikem says:

    Another way is by editing the “xorg.conf”.

    In the monitor section add:

    Option “DPI” “96 x 96”

  10. bodhi.zazen says:

    @Ikem – Thank you for your comments. I do not have a link to arandr or krandr, if you have one you feel I should add, post them here.

  11. Ikem says:

    I found the links for GRandR and ARandR.

  12. bodhi.zazen says:

    @Ikem – Thank you very much for the link on ArandR , I updated my post.

    The link on GrandR did not work, I am looking for a link with screenshots ;)

  13. Ikem says:

    The link to GRandR and ARandR are mangled.

    There’s no link to GRandR with screenshots.

    Only to the sourcecode.

  14. Pingback: How can I manually set Monitor Hardware in Fedora 16.

  15. Covex says:

    Did you really try to use those settings to change the DPI? It does nothing visible for me. Xft.dpi is ignored for a long time by GTK/Gnome, xrandr changes the values Xorg is returning, but it has now efect, and using Option “DPI” “96 x 96″ is overriden by EDID. Normally there is not way to disable EDID. I’d love to solve this due to Vaio P high screen resolution.

  16. bodhi.zazen says:

    @Covex sorry you are having a problem. To answer your question, yes it “works for me”. You can disable EDID if you wish, sort of depends on what video driver you are using.

  17. Mörgæs says:

    Hi, thanks for a good guide.

    When executing the command

    xrandr --auto --output DVI-1 --mode 1280x1024 --right-of DVI-0

    I get the response

    xrandr: screen cannot be larger than 1280x1280 (desired size 2560x1024)

    It seems that xrandr does not allow me to unite the screens. Is there a solution to that?

    The screen card is a Radeon X1300/X1550 (RV516) with open-source drivers.

  18. bodhi.zazen says:

    @Mörgæs you can try writing a custom xorg.conf.

    Minimal configuration would be

    Section “Screen”
    Identifier “Screen0”
    DefaultDepth 24
    SubSection “Display”
    Viewport 0 0
    Virtual 2560 1024

    You may need to specify more, do you know how to write an xorg.conf ?

  19. Mörgæs says:

    Thanks for a fast reply.

    The system didn’t boot with the proposed xorg.conf, nor did it accept other xorg.conf’s I found and adapted.

    Frankly I don’t know much about writing them, so if you can point to a guide it would be great.

    After that I tried other approaches in increasing order of desperation, and finally I installed a vanilla Ubuntu 11.10 (all other experiments have been done in L/Xubuntu). Using the GUI I had Xinerama in a few click. Weird, but that was a relief: Hardware works.

    After adding lubuntu-core to Ubuntu and booting into Lubuntu the system was back to square one: Two mirrored screens and no Xinerama.

    Will carry on testing…

  20. Mörgæs says:

    Finally it works:

    In the xorg.conf above, the arty quotes must be changed to straight ones. A loud “d’oh” (in straight quotes) was heard in the apartment when I realised that.

    With this, Xinerama worked in Lubuntu 11.10. For 12.04 it worked out of the box, just using the xrandr-command.

    If the does not behave well, this one is worth trying.

  21. bodhi.zazen says:

    @Mörgæs – Glad you got it working. I was about to post a more elaborate xorg.conf for you, sorry about the quotes, it is a wordpress thing.

  22. Compuglobe says:

    Hello all! I have a solution to autostart a screen rwsolution;

    1.make a autostart laucher opening gedit and adding these codes:

    Name=Screen Resolution
    Comment=Screen Resolution
    Encoding=UTF-8 Exec=xrandr --output VGA1 --mode 1280x1024 --pos 0x0 --rotate normal Hidden=false Terminal=true T

    2.then save this bach as a Screen-Resolution.desktop
    3.goto user(your name or anyone you user’s name have)press ctrl + h simultaniusly to show hidden files
    4.goto /User/.config and put the launcher there, then reboot

    “Remember you must to be logged as root to copy to that directory!” to do that you can type in Terminal gksudo nautilus and browse directory or you can use the copy command in Terminal.

    Good Luck!

  23. Pingback: Openbox & desktop resolution - AOA

  24. Kay Man says:

    Because of poor eyesight I am using a 32″ LCD monitor with a native screen resoution of 1366×768. How would I be able to set the resolution to this value?

  25. bodhi.zazen says:

    @Kay Man – Depends on your graphics card and output of xrandr. You might also wish to increase your DPI

  26. DonaldB says:

    Thanks so much, the xrandr command has allowed me to use 1600X1200 in a Virtual box VM. I am running the latest version of Bohdi as a guest, Win 7 is host. Am I correct in assuming I can not get 1920×1080 resolution in the guest (I have an laptop that is capable of 1920×1080 with the ATI 5870M in Win 7)

  27. bodhi.zazen says:

    @DonaldB – Try install the virtyual box guest additions and re-start the virtual machine.

  28. Pingback: OriginEM’s AnDroidDesk | EMpact Positive

  29. Shasankh Shrestha says:

    ———————–SOLUTION FOR xrandr: screen cannot be larger than————-

    Step .1 Check if you have xorg.conf file in /etc/X11 …..yes: goto step 3 else step 2

    Step .2 Create xorg.conf file using following step

    Step 2.a switch to console mode: Alt+Ctrl+F1
    Step 2.b kill x server: sudo service lightdm stop
    Step 2.c generate new xorg.conf file: sudo X -configure — this
    will create file in your current dir
    Step 2.d rename and move: sudo mv /etc/X11/xorg.conf
    Step 2.e return to GUI: sudo start lightdm

    Step .3 Open /etc/X11/xorg.conf and add “Virtual 3200 1080” under subsection “Display”

    Step 3.a vi /etc/X11/xorg.conf
    Step 3.b Add “Virtual 3200 1080” to ALL SubSection “Display”
    FOR ALL SCREEN if you have more than one “Display”
    Subsection and more than 1 screen (replace 3200 1080
    with your desired screen resolution)
    Section “Screen”
    Identifier “Screen1”
    Device “Card1”
    Monitor “Monitor1”
    SubSection “Display”
    Viewport 0 0
    Depth 1
    Virtual 3200 1080
    Section “Screen”
    Identifier “Screen2”
    Device “Card1”
    Monitor “Monitor1”
    SubSection “Display”
    Viewport 0 0
    Depth 1
    Virtual 3200 1080

    Step 4. Restart your computer/laptop

    Step 5. Create a script (vi /etc/X11/ and include following

    xrandr –output DVI-0 –mode 1280×1024
    xrandr –output DVI-1 –mode 1920×1080
    xrandr –output DVI-0 –auto –right-of DVI-1 –pos 1920×0

    change the file permission chmod 755 /etc/X11/
    (note: my screen1 is DVI-1 and screen2 is DVI-0, and replace resolution as per need)
    Step 6. Execute the script and see if it works. (/etc/X11/

    Step 7. If the script works, include the script to Auto Start

    Menu >> Settings >> Session and Startup >> Application Autostart >> Add
    Name: Dual Monitor Xfce
    Description: Dual Monitor Xfce
    Command: /etc/X11/
    Step 8. Restart and enjoy

    Step 9. Redo step 7 for all users logged in as the user

    (Please let me know if it worked

  30. Pingback: Set custom resolution when Display Data Channel is broken | DL-UAT

  31. Pingback: Relusi Link Directory Script. |

Leave a Reply

Your email address will not be published. Required fields are marked *