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.
| Key | keyCode | Note |
|---|---|---|
| Enter (main keyboard) | 13 | code tells the main Enter (Enter) from the numpad one (NumpadEnter). |
| Space | 32 | |
| Left, Up, Right, Down arrows | 37, 38, 39, 40 | |
| A to Z | 65 to 90 | On a US layout; other layouts can differ. |
| Shift, Ctrl, Alt | 16, 17, 18 | |
| F1 to F12 | 112 to 123 | |
| Backspace, Tab | 8, 9 | |
| Escape | 27 | |
| Page Up, Page Down, End, Home | 33, 34, 35, 36 | |
| Insert, Delete | 45, 46 | |
| Caps Lock | 20 | |
| Digits 0 to 9 (main row) | 48 to 57 | |
| Numpad 0 to 9 | 96 to 105 | With Num Lock on. |
| Comma, Period | 188, 190 | On a US layout. |
| Semicolon | 186 | Firefox reports 59. |
| Minus | 189 | Firefox reports 173. |
| Input method or dead key | 229 | Reported 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
| Key | keyCode | Note |
|---|---|---|
| Enter (main keyboard) | 13 | code tells the main Enter (Enter) from the numpad one (NumpadEnter). |
| Space | 32 | |
| Left, Up, Right, Down arrows | 37, 38, 39, 40 | |
| A to Z | 65 to 90 | On a US layout; other layouts can differ. |
| Shift, Ctrl, Alt | 16, 17, 18 | |
| F1 to F12 | 112 to 123 | |
| Backspace, Tab | 8, 9 | |
| Escape | 27 | |
| Page Up, Page Down, End, Home | 33, 34, 35, 36 | |
| Insert, Delete | 45, 46 | |
| Caps Lock | 20 | |
| Digits 0 to 9 (main row) | 48 to 57 | |
| Numpad 0 to 9 | 96 to 105 | With Num Lock on. |
| Comma, Period | 188, 190 | On a US layout. |
| Semicolon | 186 | Firefox reports 59. |
| Minus | 189 | Firefox reports 173. |
| Input method or dead key | 229 | Reported 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.location | Shown as |
|---|---|
| 0 | Standard |
| 1 | Left |
| 2 | Right |
| 3 | Numpad |
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 toolsScreen Resolution
See your screen resolution in CSS pixels, device pixel ratio, estimated physical pixels, viewport size and color depth, as your browser reports them.
Browser Info
See what your browser tells websites: screen and window size in CSS pixels, pixel ratio, time zone, languages, processor count and user agent.
User Agent Parser
Paste a User-Agent string to read the browser, engine, OS and version, device type and model, CPU hints or the crawler it names, with notes on frozen values.
Internet Ping Test
Time 5 HTTP requests from your browser to this site and see the median, min, max and jitter in ms. An HTTP round trip, not an ICMP ping.
Typing Speed Test
Typing speed test with 15, 30, 60 and 120 second runs. See gross and net words per minute (WPM), accuracy and uncorrected errors while you type; pasting is off.
JS Object to JSON Converter
Paste a JavaScript object or array literal and get JSON. Unquoted keys, single quotes and trailing commas are accepted, and no code is run.