Skip to main content
CalcChef

Keycode Checker

Press a key to see its event.key, event.code, location and modifiers, plus the deprecated keyCode and which numbers: Enter is 13, Space 32, A to Z 65 to 90. How it works

Use the Keycode Checker

Press any key

Its key, code, keyCode and modifiers appear here.

keyCode and which are deprecated

They are shown because older tutorials and libraries still use them. MDN says to avoid them in new code: test event.code for the physical key and event.key for the character instead. The numbers also differ between browsers and keyboard layouts (for example a Russian layout reports 190 for both Period and Slash), and a key the browser cannot identify reports 0.

The page listens while it is open; the Tab key and shortcuts such as Ctrl+W still do their normal job. A bare / is kept from the site search shortcut so it can be shown.

keyCode values for common keys (US layout for letters)
KeykeyCodeNote
Enter (main keyboard)13code tells the main Enter (Enter) from the numpad one (NumpadEnter).
Space32
Left, Up, Right, Down arrows37, 38, 39, 40
A to Z65 to 90On a US layout; other layouts can differ.
Shift, Ctrl, Alt16, 17, 18
F1 to F12112 to 123
Backspace, Tab8, 9
Escape27
Page Up, Page Down, End, Home33, 34, 35, 36
Insert, Delete45, 46
Caps Lock20
Digits 0 to 9 (main row)48 to 57
Numpad 0 to 996 to 105With Num Lock on.
Comma, Period188, 190On a US layout.
Semicolon186Firefox reports 59.
Minus189Firefox reports 173.
Input method or dead key229Reported while text is being composed.

About the Keycode Checker

Enter is keyCode 13, Space 32, the arrow keys 37 to 40, A to Z 65 to 90 and F1 to F12 112 to 123, but keyCode is deprecated: MDN says to test event.code for the physical key and event.key for the character instead. Press any key on this page to see its key, code, keyCode, which, location, modifiers, repeat and isComposing values; the last 10 presses stay in a table so you can compare a sequence or a shortcut.

keyCode values for common keys

KeykeyCodeNote
Enter (main keyboard)13code tells the main Enter (Enter) from the numpad one (NumpadEnter).
Space32
Left, Up, Right, Down arrows37, 38, 39, 40
A to Z65 to 90On a US layout; other layouts can differ.
Shift, Ctrl, Alt16, 17, 18
F1 to F12112 to 123
Backspace, Tab8, 9
Escape27
Page Up, Page Down, End, Home33, 34, 35, 36
Insert, Delete45, 46
Caps Lock20
Digits 0 to 9 (main row)48 to 57
Numpad 0 to 996 to 105With Num Lock on.
Comma, Period188, 190On a US layout.
Semicolon186Firefox reports 59.
Minus189Firefox reports 173.
Input method or dead key229Reported while text is being composed.

Values from MDN's KeyboardEvent.keyCode page. The numbers differ between browsers and layouts: with a Russian layout both Period and Slash report 190, and a key that cannot be identified reports 0.

event.location values

event.locationShown as
0Standard
1Left
2Right
3Numpad

Left Shift gives 1 and right Shift 2; the numpad keys give 3.

Frequently asked questions

What is the keyCode for Enter?
13, and the numpad Enter reports 13 too. event.code tells them apart: Enter for the main key, NumpadEnter for the numpad. The copy button gives two comparisons, one per line, event.key === "Enter" and event.code === "Enter": keep the one you need, or join them with &&.
Is keyCode deprecated?
Yes. MDN marks KeyboardEvent.keyCode deprecated with the advice to avoid it in new projects, and the same goes for which. The tool still shows both because older code and tutorials use them, labeled as deprecated.
What is the difference between event.key and event.code?
event.key is the character the key produces with the current layout and modifiers, or a name such as Enter; event.code names the physical key, such as KeyA, whatever the layout. Use code for game controls and shortcuts tied to a position, key for text.
Why is keyCode 229?
An input method (IME) or a phone keyboard is composing text, so the real key is not reported yet. MDN suggests ignoring keydown events where event.isComposing || event.keyCode === 229, because isComposing alone can be false at the start or end of composition. Some browsers also report 229 for dead keys.
Why does keyCode show 0?
The browser could not map the key to a legacy code; MDN says a key that cannot be identified reports 0. Use event.code or event.key, which the tool shows next to it.
Does it work with a phone keyboard?
Tap the text field under the result and type. On-screen keyboards often report an empty code, key "Unidentified" or keyCode 229, and the tool adds a note when they do.

Related Tools

View all tools