Click here and press any key
Tap the box, then press a key on your keyboard
100% Private
Key events are read locally in your browser. Nothing is logged or uploaded.
JavaScript Keycode Finder shows the event.key, event.code, and keyCode for any key you press. Detect modifier keys and key location instantly for building keyboard shortcuts.
Written & reviewed by Helperzy Editorial Team · Updated July 2026
Click here and press any key
Tap the box, then press a key on your keyboard
100% Private
Key events are read locally in your browser. Nothing is logged or uploaded.
Click or tap the capture area first so it holds keyboard focus, otherwise the keydown event goes to the page rather than to the tool.
Press any key, with or without modifiers, to see event.key, event.code, the legacy keyCode, the location index and the state of Ctrl, Shift, Alt and Meta.
Copy the property your handler needs: event.code for position-based shortcuts, event.key for named actions like Enter and Escape, and skip keyCode in new code.
Keyboard events report more information than most developers realise, and picking the wrong property is why a shortcut works on your machine and fails on a colleague. This tool listens for a keydown and shows every value the browser exposes: event.key, event.code, the deprecated keyCode and which numbers, the physical location index, and the state of the Ctrl, Shift, Alt and Meta modifiers. You click the capture area and press a key. Developers building keyboard shortcuts, game authors mapping controls, and anyone implementing accessible navigation with arrow keys and Escape all need to know precisely what arrives in the handler rather than what they assume arrives. The distinction that matters is between what a key produces and where a key sits. event.key reports the produced character or action, so it respects the keyboard layout and any modifiers: pressing the A key gives the string a, and holding Shift while pressing it gives A. event.code reports the physical key position using a fixed naming scheme based on a US layout, so that same key reports KeyA whether the user has QWERTY, AZERTY or Dvorak configured. The practical rule is to use event.code for shortcuts tied to a hand position, such as WASD movement in a game, and event.key for anything about text or named actions like Enter and Escape. The location property disambiguates duplicated keys, telling you whether Shift came from the left or right side and whether a digit came from the main row or the numeric keypad. Press a few keys and the pattern becomes clear. Press the letter a on its own and event.key is a, event.code is KeyA, the legacy keyCode is 65 and no modifier flags are set. Hold Shift and press the same physical key: event.key changes to A, but event.code stays KeyA because the physical key has not moved, and shiftKey is now true. Press Enter on the main keyboard and event.key is Enter with event.code also Enter and keyCode 13; press Enter on the numeric keypad instead and event.key is still Enter but event.code becomes NumpadEnter. That last pair is exactly why event.code exists: two keys, one meaning, distinguishable only by their code. Try the arrow keys as well and you will see ArrowUp reported identically in both key and code, which is why arrow-key navigation is one of the few cases where either property works safely. Real uses. A developer building a command palette binds Ctrl plus K by checking event.ctrlKey together with event.key, and discovers on a Mac they also need metaKey for the Cmd variant. A game author maps WASD with event.code so a French AZERTY user does not end up steering with ZQSD. Someone adding accessibility to a modal listens for event.key equal to Escape, which is layout-independent and correct everywhere. A form developer needs Enter to submit but Shift plus Enter to insert a newline, which requires reading both key and shiftKey in the same handler before deciding. Two cautions. keyCode and which are shown for reference because you will meet them in older tutorials and legacy codebases, but they are deprecated and inconsistent across layouts, so do not reach for them in new work no matter how many Stack Overflow answers still use 13 for Enter. The other pitfall is assuming Ctrl is universal: macOS uses Cmd, which surfaces as metaKey rather than ctrlKey, so a shortcut checking only ctrlKey silently does nothing for Mac users. Test both, or normalise the two into one check. Note also that browsers reserve some combinations for themselves, such as Ctrl plus W to close a tab, so your handler may never receive them at all no matter how you register the listener. Detection runs entirely in your browser and no keystroke is logged, stored or transmitted anywhere.
Input
Press the A key, then press Shift and A together
Result
First: key = a, code = KeyA, keyCode = 65. Second: key = A, code = KeyA, shiftKey = true
event.key changes because the produced character changed, while event.code stays KeyA because the physical key never moved, which is the whole reason both properties exist.
Input
Press Enter on the main keyboard, then Enter on the numeric keypad
Result
First: key = Enter, code = Enter. Second: key = Enter, code = NumpadEnter
Both keys produce the same action so event.key is identical, and only event.code lets you tell them apart when the two should trigger different behaviour.
Click the capture box on this page and press any key on your keyboard. The tool immediately displays event.key, event.code, the numeric keyCode, the key location, and which modifier keys were held. Press another key at any time to update the values.
UUID Generator creates random UUIDs (v4) and GUIDs online for free. Generate unique identifiers instantly for databases, APIs, and development. No signup needed.
Image to Base64 Converter encodes any image into a Base64 data URI online for free. Get ready-to-use CSS and HTML code in your browser.
JSON to YAML Converter changes JSON into clean YAML instantly online for free. Validate and convert config data in your browser with no upload.
Cron Expression Generator builds and explains cron schedules online for free. Create cron expressions with a plain-English description in your browser.
Image Resizer changes image dimensions online — set exact pixels, use percentage scaling, or pick from 12 presets (Instagram, Passport, YouTube, etc.). Target specific file sizes like 50KB or 100KB. Batch resize multiple images. 100% free, browser-based.
Image Converter changes images between any format online free — JPG, PNG, WebP, AVIF, PDF, ICO, BMP, HEIC, GIF, SVG. Batch conversion, resize, rotate, flip, AI format recommendation. 100% browser-based, no upload.
Convert JPG to WebP format online free — reduce image file size by 25-35% with identical visual quality. Batch conversion, adjustable quality, lossless mode available. Boost website speed and Core Web Vitals scores. 100% browser-based, no upload needed.
Convert PNG to WebP format online free — reduce file size by 26-34% while preserving full transparency. Batch conversion, lossless and lossy modes, adjustable quality. Boost website performance and Core Web Vitals. 100% browser-based, no upload needed.