# JavaScript Keycode Finder - Show event.key, event.code and keyCode for Any Key

> Free online JavaScript key event viewer: press a key to see event.key, code, keyCode, location and modifiers, with an on-screen keyboard and a reference table.

- URL: https://qilingtools.com/en/keycode
- Category: Developer Tools (https://qilingtools.com/en/dev)
- Tags: [Developer](https://qilingtools.com/en/tags/dev), [Frontend](https://qilingtools.com/en/tags/frontend)
- Last updated: 2026-10-26
- Price: Free, no sign-up
- Privacy: Runs locally in the browser; files are never uploaded

Writing keyboard shortcuts, game controls or form interactions means knowing exactly what a key looks like in JavaScript. Open this page and press any key to see the combination in large type plus event.key, event.code, keyCode, which, location (left, right or numpad), repeat, isComposing and the Ctrl, Shift, Alt, Meta and CapsLock states. The US-layout on-screen keyboard highlights keys that are down and keys you have pressed, which also makes it a quick keyboard tester. A history table logs recent keydown (and optionally keyup) events, and an IME test field shows compositionstart / update / end events to explain keyCode 229 during Chinese or Japanese input. From the last key you can copy an addEventListener snippet that matches by key or by code. At the bottom is a searchable reference table of common keys with their key, code and keyCode. Note that keyCode and which are deprecated; new code should use key or code.

## How to use

1. Click an empty area so the page has focus, then press any key or shortcut
2. Read event.key, code, keyCode and more while the on-screen keyboard lights up
3. Copy the generated JavaScript condition, or search the reference table for other keys

## Features

- Live key, code, keyCode, which, location, repeat and isComposing
- Modifier states and a readable shortcut name
- US-layout on-screen keyboard that doubles as a keyboard tester
- Key history table with optional keyup logging
- IME composition event test
- Copyable JS snippet matching by key or code
- Searchable reference table of common keys

## FAQ

### What is the difference between event.key, event.code and keyCode?

event.key is the character or function the key produces and changes with layout and Shift ("a", "A", "Enter"). event.code is the physical key position, independent of layout ("KeyA", "ShiftLeft"), which suits position-based controls such as WASD. keyCode is a legacy numeric code that is deprecated and inconsistent across browsers and layouts, so avoid it in new code.

### Why are some keys or shortcuts not detected?

Shortcuts reserved by the browser or OS, such as Ctrl+W, Ctrl+T or Cmd+Q, are handled before the page sees them and cannot be intercepted. The Fn key usually produces no event, and some media keys depend on the system and browser. The page must also have focus; keys pressed while the address bar or another window is focused are not delivered.

### Why is keyCode 229 during IME input?

While an input method is composing text, browsers report key "Process", keyCode 229 and isComposing true on keydown; the final text arrives in compositionend or input events. Shortcut handlers should check event.isComposing first so they do not fire while the user is picking characters, and the snippet generated here already does.

### Can I use it to test whether my keyboard has dead keys?

Yes. The on-screen keyboard marks keys you have pressed in light blue and keys currently held in dark blue. Press every key once and any key that stays uncolored was not detected. You can also hold several keys at once to test rollover (how many simultaneous keys your keyboard reports).

## Related tools

- [JSON Formatter](https://qilingtools.com/en/json): Free online JSON formatter: beautify or minify, validate with the exact line and column of any error, browse a collapsible tree, sort keys and escape strings.
- [Base64 Encode/Decode](https://qilingtools.com/en/base64): Free online Base64 encoder and decoder: UTF-8 safe, optional URL-safe variant, convert text to Base64 and back in real time. Processed locally, never uploaded.
- [URL Encode/Decode](https://qilingtools.com/en/url-encode): Free online URL encoder and decoder with encodeURIComponent and encodeURI modes. Escapes Chinese, spaces and special characters. Real-time and local, no upload.
- [JWT Decoder](https://qilingtools.com/en/jwt): Free online JWT decoder: decode the header and payload of a JSON Web Token, show expiry and issued-at times, all locally without uploading the token.
- [Timestamp Converter](https://qilingtools.com/en/timestamp): Free online Unix timestamp converter: convert timestamps and dates, auto-detect seconds or milliseconds, and show local, UTC, ISO 8601 and relative time.
- [Hash / Checksum](https://qilingtools.com/en/hash): Free online hash calculator: SHA-1, SHA-256, SHA-384 and SHA-512 of text or any file through the browser crypto API. Files never leave your device.
- [UUID Generator](https://qilingtools.com/en/uuid): Free online UUID generator: create RFC 4122 UUID v4 in bulk with a cryptographic RNG. Options for uppercase, no hyphens and braces, with one-click copy.
- [Base Converter](https://qilingtools.com/en/base-convert): Free online number base converter: convert between binary, octal, decimal, hexadecimal and any base 2–36. Uses BigInt for huge integers, computed locally.
