Mac Keyboard Shortcut Visualizer â Online Modifier Key Cheatsheet
Press a combination of modifier keys and see which common macOS shortcuts use them. Learn by experimentation.
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 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.
Check if a URL can be embedded in an iframe. Test your siteâs defense against clickjacking. Browserâbased.
Generate a Nuxt 3 page component with script setup, metadata, and styles. For Vue.js developers. Copy the .vue file.
Write a JavaScript snippet and get a readyâtoâdrag bookmarklet link. With minification and encoding. Easy browser tools.
Build a complete Event structured data with performer, location, and dates. Get Googleâready JSONâLD for tickets.
A textarea that expands in height as you type. See the implementation and copy the code. No library needed.
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.
Write JavaScript using element.animate() and see the result in a live preview. Compare with CSS keyframes. Debugger included.
Connect your MIDI keyboard and see pressed notes visually on a piano roll. Check velocity, channel, and aftertouch. No DAW needed.
Compare :focus and :focusâvisible styling. See which one applies when using mouse vs. keyboard. Accessible focus management.
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.
Paste any JavaScript expression and see its evaluated type and value. Understand JS coercion and type quirks. Educational.
Enter a URL and extract tabâindex order violations and focusable elements. Quick accessibility audit. Clientâside fetch.
Type any condition and see the result of the ternary operator. Understand truthy/falsy values. Quick learning tool.
Create a personal countdown to any future date (birthday, vacation, launch). Shows days, hours, minutes, seconds. Locally stored.
Play a virtual piano keyboard using mouse or computer keys. Sustain and octave control. Record and play back your tune.