When I use my Windows laptop, I’m always accidentally brushing against the Num Lock key. I suppose it’s because the keys are so flat; I never have this problem on a desktop.
I thought there must be some way to set it so that it’s always on, so I searched for it. First I found articles on how to turn Num Lock on at startup, but that’s not my problem. The key already is on when I start up, but it doesn’t stay on when I brush against it.
Next I found articles say to set a certain registry key. That didn’t work for me, and apparently a lot of other people have the same experience.
Some articles say to edit your BIOS. My understanding is that you can edit the BIOS to permanently disable the key, but I wanted to permanently enable the key.
Here’s what did work: give AutoHotKey the command
I haven’t used AutoHotKey before. I’ve heard good things it, but it seems like it can be quite a deep rabbit hole. I intend to look into it a little, but for now I just want my Num Lock to stay on.
After you install AutoHotKey and run it, you get its help browser, not the app per se, and it’s not immediately obvious how to run the code above. You need to save the line of code to a file whose name ends in
.ahk, such as
numlock.ahk. If you double-click on that file, it will run the AutoHotKey script. To make it run automatically when your computer starts up, put the script in your Startup folder. This is probably
You can bring up the Startup folder by typing Windows key + R, then
Related post: Remapping the Caps Lock key
8 thoughts on “How to Set Num Lock on permanently”
I had a similar impression of AutoHotKey. Very powerful, flexible, and well-designed by a programmer who takes pride in doing it right. And the vast majority of people who use it probably just need something very simple, like having a single button pushed repeatedly in a video game.
I’m grateful for the program though. In the past I’ve downloaded programs hoping they would do what I need, but ended up disappointed and frustrated. With AutoHotKey I’m confident it can do it, if I can figure out how.
Thanks for this. It works and works well!
Thank you for making my day better!!!
Obviously AHK will work, but for whoever play online games, beware, simply having AHK installed on your computer will trigger EasyAntiCheat or any other similar anticheat and get you banned.
Do not run AHK if you play online, even if it’s idle or running a script for something totally unrelated.
I always did it in registry base by modifying the value of InitialKeyboardIndicators and setting it to “2”. This doesn’t seem to work anymore (at least on my laptop, maybe it’s valable for desktops) but it still has to be possible via registry. No need for 3rd party apps.
Thank you very much.
I have been looking for some way to do exactly this for years. I tried all the other hacks and don’t trust random freeware apps that tout a solution, as most of them are keyloggers working for criminals.
I hope this is the end of being ambushed by a silent and unintended switch to the non-numeric mode of my numeric key pad, just when I start keying in numbers by muscle memory but instead get garbage, which has been quite irksome.
No, not reliable… In some circumstances the lock on the NumLock state it circumvented and then you stuck with the off state. We’ve to add a loop and check periodically the Numlock state and re-establish it. It’s a shame for Microsoft not to give an user or admin the ability to configurate that annoyance, which existed since the AT-PC era…
Okay, didn’t wanted to, but in the end I was annoyed enought to have a look into the manual of AutoHotKey…
The following script tales the current NumLock state and lock it down.
1) The script takes the current NumLock state and locks it.
2) If the state is changed by a program, the script restores it on using the Numpad-Keys 0 – 9 and decimal point.
3) LeftAlt – Win – NumLock toggles the state
4) Win – NumLock print the current state on screen
5) any other combination of NumLock is ignored.
6) How to change the boot state of NumLock with the Registry, please look below in the heather.
Hope, the script helps.
;Unwanted Change of NumLock-State by User or Software.
;The Script takes the initial NumLock state and lock it down.
;If NumLock state changed by program or user, the script restores
;the fixed state on hitting Numpad 0 – 9 or Decimal-Dot-Key.
;Win-NumLock: Display State
;To command Windows a initial state after boot,
;set in Bios NumLock to “On” or
;modify Registry Key HKEY_USERS\.DEFAULT\Control Panel\Keyboard, value InitialKeyboardIndicators
;Microsoft modified the behaviour. Depending on System, the default values are 0 or 2147483648.
;Add a value of 2.
;Initial-commands by AutoHotkey
#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.
;Take current NumLock-State as initial falue and lock it down.
CurrentState := GetKeyState(“NumLock”,”T”)
If (CurrentState = 1)
TargetState := “On”
TargetState := “Off”
PermaState := TargetState
;Play Error-Sound on NumLock
;State enquery on Win-NumLock
MsgBox, NumLock-Current permanent setting for NumLock: %PermaState%`nChange with LeftAlt-Win-NumLock
;Change permanent state on LeftAlt-Win-NumLock
CurrentState := GetKeyState("NumLock","T")
If (CurrentState = 0)
TargetState := "On"
TargetState := "Off"
PermaState := TargetState
;Defines for "On"
#If PermaState = "On"
;Defines for Off
#If PermaState = "Off"
After many years of frustration, i found this site and love the solution. now to see if it plays nice with excel and my procedures.
thanks a million for solution.