KEY
Keycode Reference
A quick reference of keyboard key codes.
Ad · Large Rectangle (336×280)
How to use Keycode Reference
A quick reference of keyboard key codes.
- Press Show table to list the common keys with their event.keyCode and event.code values.
- Find the key your handler needs to respond to.
- Copy its code into your JavaScript key handler.
When you actually reach for this
- You are wiring up a keydown handler and need the right event.key, event.code, or legacy keyCode for a specific physical key.
- A shortcut is firing on the wrong key across browsers and you want to confirm which property to compare against.
Where this tool stops being accurate
- event.keyCode is deprecated and inconsistent across browsers and keyboard layouts — prefer event.code (physical key) or event.key (character).
- event.code describes the physical position, so the same code can produce different characters on a French vs US keyboard.
Frequently asked questions
What does Keycode Reference do?
A quick reference of keyboard key codes.
Should I check event.key or event.code for a shortcut?
Use event.code when you mean a physical key (e.g. the WASD cluster) and event.key when you mean the typed character. event.keyCode should be avoided entirely in new code.
Why does my "Ctrl+S" handler not match what the reference shows?
You may be comparing keyCode instead of key; for a save shortcut compare event.ctrlKey (or metaKey on macOS) together with event.key === "s".