Keyboard Event Debugger - Online See keydown Key Data
Press any key and see the full KeyboardEvent object: key, code, keyCode, modifier status. Dev tool.
UD5 Toolkit
| # | Key | Code | KeyCode | Location | Modifiers | Type | Time |
|---|---|---|---|---|---|---|---|
| Press keys to see history | |||||||
0 or Unidentified. For best results, use a physical keyboard.
event.keyCode property during keyboard events like keydown and keyup. Each key has a unique code — for example, the Enter key has keyCode 13, the letter "A" has keyCode 65, and the Escape key has keyCode 27. Although keyCode is now deprecated, it remains widely used for backward compatibility.
event.key returns the logical character produced by the key — what the user intended to type. For example, pressing the "A" key produces 'a' (or 'A' with Shift).event.code returns the physical key location on the keyboard, regardless of layout. The "A" key always returns 'KeyA', even on AZERTY keyboards where it produces a different character. This makes code ideal for game controls and layout-independent key detection.
event.keyCode was deprecated because it's not layout-independent. The same physical key can produce different keyCode values depending on the keyboard layout and locale. It also doesn't account for modifier keys well. The modern event.code property provides a consistent, layout-independent identifier, while event.key gives the actual character. Together they offer a cleaner, more predictable API.
event.key when you need to know which character was typed (e.g., 'Enter', 'a', 'Escape').event.code when you need to identify which physical key was pressed (e.g., 'KeyA', 'ArrowLeft', 'ShiftRight').event.ctrlKey, event.shiftKey, event.altKey, and event.metaKey.
document.addEventListener('keydown', function(event) {
if (event.key === 'Enter') {
// Handle Enter key
}
if (event.key === 'Escape') {
// Handle Escape key
}
if (event.code === 'ArrowUp') {
// Handle Arrow Up (layout-independent)
}
});
Legacy approach:
document.addEventListener('keydown', function(event) {
if (event.keyCode === 13) { /* Enter */ }
if (event.keyCode === 27) { /* Escape */ }
if (event.keyCode === 38) { /* Arrow Up */ }
});
keydown — Fires when a key is pressed down. Repeats while the key is held.keyup — Fires when a key is released.keypress — Deprecated. Previously fired for character-producing keys. Do not use in new code.beforeinput — Fires before input is inserted (useful for input interception).input — Fires when the input value changes.event.location identifies where on the keyboard a key is physically located:
event.key or event.code where supported, or use input events for text entry.
| Key | KeyCode | Code | Key |
|---|---|---|---|
| Enter | 13 | Enter | Enter |
| Tab | 9 | Tab | Tab |
| Escape | 27 | Escape | Escape |
| Space | 32 | Space | |
| Backspace | 8 | Backspace | Backspace |
| Delete | 46 | Delete | Delete |
| Arrow Left | 37 | ArrowLeft | ArrowLeft |
| Arrow Up | 38 | ArrowUp | ArrowUp |
| Arrow Right | 39 | ArrowRight | ArrowRight |
| Arrow Down | 40 | ArrowDown | ArrowDown |
| F1–F12 | 112–123 | F1–F12 | F1–F12 |
| A–Z | 65–90 | KeyA–KeyZ | a–z |
| 0–9 (top row) | 48–57 | Digit0–Digit9 | 0–9 |
| Numpad 0–9 | 96–105 | Numpad0–Numpad9 | 0–9 |
event.preventDefault() in your keydown handler. Be selective — blocking all keys breaks accessibility and browser functionality.
document.addEventListener('keydown', function(event) {
// Prevent F5 refresh
if (event.code === 'F5') {
event.preventDefault();
}
// Prevent Ctrl+S save dialog
if (event.ctrlKey && event.code === 'KeyS') {
event.preventDefault();
// Your custom save logic
}
});
Note: Some browser shortcuts (like Ctrl+W to close tab) cannot be overridden for security reasons.
Press any key and see the full KeyboardEvent object: key, code, keyCode, modifier status. Dev tool.
Press a combination of modifier keys and see which common macOS shortcuts use them. Learn by experimentation.
Fill in event details and generate 'Add to Calendar' links for Google, Outlook, and Yahoo, plus a downloadable .ics file.
Encrypt and decrypt text using AES in the browser with a password. Uses Web Crypto API. No data sent to server.
Check if a URL can be embedded in an iframe. Test your site’s defense against clickjacking. Browser‑based.
Strip specific or all attributes from HTML tags. Clean up messy code. Keep the structure. Purely local.
Type a modern English word and get a possible Old English equivalent. Works offline with a limited but curated wordlist. Learn history.
Enter a username and password to generate an .htpasswd entry using bcrypt. Runs entirely in browser.
Scale a jerky marinade recipe based on meat weight. Includes optional cure #1 calculation for safety.
Compare standard keyboard layouts side-by-side. Click keys to see characters. Useful for learning alternative layouts.
Write a JavaScript snippet and get a ready‑to‑drag bookmarklet link. With minification and encoding. Easy browser tools.
Drop a PDF and extract any embedded JavaScript or form actions. Check for malicious code. Privacy‑friendly analysis.
Build a complete Event structured data with performer, location, and dates. Get Google‑ready JSON‑LD for tickets.
Paste JavaScript and catch syntax errors instantly with line numbers. Lightweight pre‑commit check. Local.
Watch a simulation of how the JavaScript event loop handles synchronous code, microtasks, and macrotasks. Learn async.
Create promises that resolve or reject after a delay. See state changes and chain .then/.catch. Debug async code.
Write a generator function and step through it with next(). See values and done state. Understand iterators.
Apply a Proxy to an object and see the get/set traps log fired in real time. Understand metaprogramming. Local.
Press any key combination and record the sequence. Export as JSON or human‑readable text. Perfect for documenting shortcuts.
See the roving tabindex pattern in action. Use arrow keys to navigate a list. Copy the accessible JavaScript pattern.
Connect your MIDI keyboard and see pressed notes visually on a piano roll. Check velocity, channel, and aftertouch. No DAW needed.
Touch the screen and see the exact coordinates, radius, and force of each touch point. Indispensable for mobile web devs.
Test the Fullscreen API: request fullscreen on a colored div, detect changes, and copy the JavaScript boilerplate.
Choose Babel presets (env, React, TypeScript) and plugins. Get a clean babel.config.json to transpile your code. Local tool.
Press any key to see the complete KeyboardEvent properties: key, code, keyCode, modifiers. Indispensable for game & shortcut developers.
Write JavaScript code and see the output or console.log results immediately. Safe iframe sandbox. For quick experiments.
Paste any JavaScript snippet and get a ready‑to‑drag bookmarklet link. Minify and encode automatically. Pure client.
Press any key and see it light up on a standard QWERTY layout. Check functionality or demonstrate shortcuts.
Convert any text into JavaScript‑style \uXXXX escape sequences and vice versa. Handles emojis. Useful for i18n development.
Plan a party or event budget by category (venue, food, decorations). See total and cost per guest. Export summary.