Mute and Adjust Volume with Keyboard Hotkeys

This is a sequel to my first screencast on the same topic. This improved version uses only AutoHotkey to adjust the volume and mute, and it works on Windows XP and Windows 7.

Here’s the screencast. See below for detailed instructions on how to set it up for yourself.

Step 1: Download and install AutoHotkey.

Step 2: Download volume.ahk (shown below) and put it in the Startup folder. To find the Startup folder, click the Start button, then All Programs. Right-click on the Startup folder and click Open.

Step 3: Run volume.ahk by double clicking on it. This is what’s in volume.ahk.

; Volume control (turn master volume up and down with Ctrl-Alt-Up/Down and
; toggle mute with Ctrl-Alt-.)
^!Up::Send {Volume_Up}
^!Down::Send {Volume_Down}
^!.::Send {Volume_Mute}

That’s it. Now you can use these keyboard shortcuts to adjust the volume and toggle mute.

Ctrl-Alt-Up: Increase the volume
Ctrl-Alt-Down: Decrease the volume
Ctrl-Alt-Period: Mute the volume





  1. Thank you very much. I have been trying to figure it out.
    Interesting that a period and keypad decimal point are
    two different things to windows running but ahk seems to ‘see’
    them both as a period when typed in the script.

      » Comment by Rob on May 20, 2010 @ 3:35 pm
  2. You’re welcome. And that is interesting about the period and the number pad decimal point. It kind of makes sense that they both work, but knowing AHK, I bet there’s a way to distinguish them too.

      » Comment by Dan on May 20, 2010 @ 8:23 pm
  3. [...] to adjust the volume with a keyboard shortcut Update: Here’s an easier way to do [...]

      » Pingback by How to adjust the volume with a keyboard shortcut on November 14, 2010 @ 1:30 am
  4. [...] To translate infrared signals to keyboard commands,[Shawn] decided to base his project off a previous build that used a small program called [...]

      » Pingback by Control your PC with a remote - Hack a Day on March 5, 2012 @ 7:53 am
  5. Thank you for this script. Volume up and down work, but mute doesn’t work for me. What can I do?

      » Comment by Alberto Cabas Vidani on April 16, 2012 @ 2:14 am
  6. @Alberto A quick way to debug the script is to run the Window Spy (on the right-click menu of the AutoHotKey tray icon) to see what happens when you hit the key sequence for mute.

      » Comment by Dan on April 16, 2012 @ 10:16 pm
  7. i have been trying to do this but its not working. could i get step by step on what to do

      » Comment by jimmy on May 15, 2012 @ 8:00 pm
  8. @jimmy When you say it’s not working, what isn’t? Does the AutoHotkey script run without errors? If so, what happens when you use the shortcut? You can right click on the autohotkey script when it’s running and select Window Spy to get more details about what’s going on.

      » Comment by Dan on May 15, 2012 @ 8:16 pm
  9. Thanks, though it makes more sense to me to use page up, page down, and end for it. but then again i forget my Fn key doesn’t work…

      » Comment by meltedspades on August 5, 2012 @ 11:20 pm
  10. @meltedspades If that works for you, run with it. If I used PageUp and PageDown I’d be adjusting my volume up and down all day :)

      » Comment by Dan on August 5, 2012 @ 11:33 pm
  11. [...] http://dan.hersam.com/2010/05/06/mute-and-adjust-volume-with-keyboard-hotkeys/ [...]

      » Pingback by Hangerő állítás billentyűzetről « voji's world on August 21, 2012 @ 3:06 pm
  12. This only works if you already have the volume bar up. Why bother at that point?

      » Comment by unagieel on September 5, 2012 @ 10:52 am
  13. @unagieel It’s a global shortcut – it works whenever you use the keys no matter what you’re doing.

      » Comment by Dan on September 6, 2012 @ 2:28 pm
  14. awesome! thx very much!

    I’ve set my UP/DOWN to use the Plus / Minus keys

    ^!=::Send {Volume_Up}
    ^!-::Send {Volume_Down}
    ^!.::Send {Volume_Mute}

      » Comment by mr a on September 30, 2012 @ 3:35 pm
  15. Thanks! :) that’s great! i’ll start a new era of shortcuts! :D everrrrything will be a shortcut soon! :D :D

      » Comment by mohamed on October 11, 2012 @ 10:14 pm
  16. @mohamed You’re welcome and you have my permission to go crazy with shortcuts for everything!

      » Comment by Dan on October 11, 2012 @ 10:43 pm
  17. hey dude im trying to download volume.ahk but its not downloading? it just goes to another page where the volume shorcuts are listed please help

      » Comment by george on January 8, 2013 @ 10:37 pm
  18. @george That’s the code of volume.ahk you’re seeing. To download it you can either right click on the link and save link as or click on the link normally and then save the page.

      » Comment by Dan on January 9, 2013 @ 10:22 am
  19. @dan thanks man worked perfectly :)

      » Comment by george on January 10, 2013 @ 8:43 pm
  20. thanks man this was very helpful!!

      » Comment by Matt on January 11, 2013 @ 2:35 am
  21. @Matt You’re welcome.

      » Comment by Dan on January 11, 2013 @ 10:27 am
  22. @george Cool!

      » Comment by Dan on January 11, 2013 @ 10:46 am
  23. Thank you so much for this tip/tool.
    I spilt beer on my keyboard and I had to connect my old one with no volume hotkeys :)

      » Comment by Fernando Lopez on January 22, 2013 @ 6:54 pm
  24. @Fernando I hadn’t even considered that use for this, but I’m glad it helped. Careful with your beer next time ;)

      » Comment by Dan on January 22, 2013 @ 9:17 pm
  25. Thanks for the post. This did the job!

      » Comment by Vineeth on January 31, 2013 @ 10:01 am
  26. Thanks Dan… nice one… you’re the man! Big Help…

      » Comment by Nhel on February 10, 2013 @ 7:35 pm
  27. I can’t thank you enough! Fortunately, this works in desktop mode of Windows 8.

    Thank you!!! :)

      » Comment by TBolt on April 2, 2013 @ 12:33 pm
  28. @TBolt That’s great, thanks for letting us know.

      » Comment by Dan on April 3, 2013 @ 4:09 pm
  29. it dont work

      » Comment by hassan on April 7, 2013 @ 10:05 am
  30. @hassan Try right-clicking on the Autohotkey tray icon and choosing Window Spy (that will give you more information about what’s happening)

      » Comment by Dan on April 8, 2013 @ 12:31 pm
  31. Heyup, its working, this is great. But, when I am changing the script and want to use three keys:
    1. +
    2. -
    3. 0
    it is not working. I don’t want to use helping keys like Ctrl-Alt. Is it possible?

      » Comment by Veer on April 10, 2013 @ 7:24 am
  32. @Veer You are probably going to regret using normal keys, because it will mean you can’t type a number with a 0, and you won’t be able to type a dash or a plus sign. It’s possible, but a bad idea.

      » Comment by Dan on April 10, 2013 @ 1:01 pm
  33. Dan, thanks for posting this. Unfortunately, it’s not working for me. I tried using Window Spy to debug, but nothing gets logged. Any ideas?

      » Comment by Rob on April 10, 2013 @ 2:58 pm
  34. @Rob Could you post the text from your Autohotkey script? I can run it to see what’s going on.

      » Comment by Dan on April 10, 2013 @ 3:03 pm
  35. Dan, sorry for the delay posting this.

    #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn ; Enable warnings to assist with detecting common errors.
    SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

    ^!Up::Send {Volume_Up}
    ^!Down::Send {Volume_Down}

      » Comment by Rob on April 13, 2013 @ 2:15 pm
  36. @Rob I ran your script and it worked fine. Try this script and see if you get message boxes with Up and Down when you hit the shortcut.

    #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn ; Enable warnings to assist with detecting common errors.
    SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

    ^!Up::MsgBox, Up
    ^!Down::MsgBox, Down

    Just to clarify, you run the Autohotkey script, then hold down Ctrl+Alt+Up (the arrow key, not on the number pad) or Ctrl+Alt+Down.

    Let me know how it works.

      » Comment by Dan on April 15, 2013 @ 6:03 pm
  37. Dan, thanks very much! Force of habit, I was using numpad arrow keys vs. navigation keys (duh). I modified the script as follows and it works great.

    !NumpadUp::Send {Volume_Up 2}
    !NumpadDown::Send {Volume_Down 2}

      » Comment by Rob on April 20, 2013 @ 5:41 pm
  38. Yes same here only works while the volume menu is visible.

      » Comment by John on September 5, 2013 @ 7:03 am
  39. @John Are you sure? It’s possible it’s adjusting the volume in small increments and it’s not as easy to notice. If you have to have the menu in focus, it’s probably because the Autohotkey isn’t working at all and the up and down arrow keys are adjusting the volume.

      » Comment by Dan on September 5, 2013 @ 11:00 am
  40. Helped alot, thanks very much!

    for Windows 8 users trying to locate the [Startup] folder here is the url you can copy and paste into the windows explorer:

    C:\Users\\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

    replace with your username and hit enter.

      » Comment by Taylor on September 26, 2013 @ 4:29 pm
  41. @Taylor Thanks for the Windows 8 info.

      » Comment by Dan on September 26, 2013 @ 5:08 pm
  42. Yes only works when volume menu is visible. Windows 8 x64.
    Anyone have a fix?

      » Comment by Scott on September 28, 2013 @ 10:14 am
  43. @Scott You may want to try a new version of AutoHotkey, since the version found at http://www.autohotkey.com hasn’t been updated for quite some time. Try this one: http://l.autohotkey.net/

    I don’t have a Windows 8 machine to test it on, but if it fixes the problem in Windows 8, please let us know.

      » Comment by Dan on September 28, 2013 @ 3:40 pm
  44. I find this method inconvenient because you have to repress the key for every x%
    This i find more convenient:
    $pgUp::
    loop
    {
    if not getKeyState(“pgUp”, “p”)
    break

    Send {Volume_Up}
    Sleep. 100
    }
    return

    $pgDn::
    loop
    {
    if not getKeyState(“pgDn”, “p”)
    break

    Send {Volume_Down}
    Sleep. 100
    }
    return

      » Comment by Cohen on October 14, 2013 @ 4:40 pm


Post a comment










Number of readers
- home
news links
other links

about me
blog archives
docs
entertainment
experiences
funny lists
humor
intellectual
interests
music
opinions
photos
web designs
tools
software
webmaster help

Most Popular Pages


Sign up
Enter your email address to be notified of new blog posts



Search blog archives

Calendar
May 2010
SMTWTFS
« Apr Jun »
 1
2345678
9101112131415
16171819202122
23242526272829
3031 







Random quote
If entropy is increasing, where is it coming from?

(See all the quotes)



Say hi on








(?) Choose theme:  X X X X X X
Page loaded in 0.0929 seconds