Keycode info

Find the javascript keycode, code, location and modifiers of any pressed key.

Press any key

Press the key on your keyboard you want to get info about this key

Key :
Keycode :
Code :
Location :
Modifiers :

Recent keys:

About Keycode Info

This tool helps web developers identify the various properties and values of keyboard events in JavaScript, which is essential for implementing keyboard shortcuts, accessibility features, and interactive web applications.

Keyboard Event Properties

JavaScript provides several keyboard event properties:

  • key - Returns the character or non-character key value (e.g., "A", "Enter", "Escape")
  • keyCode - Returns the Unicode value of the key (deprecated but still widely used)
  • code - Returns the physical key code (e.g., "KeyA", "Enter", "Escape")
  • location - Returns the location of the key on the keyboard (0 for standard, 1 for left, 2 for right, 3 for numpad)
  • altKey, ctrlKey, shiftKey, metaKey - Boolean values indicating if modifier keys are pressed
Common Use Cases
  • Implementing keyboard shortcuts and hotkeys in web applications
  • Creating web-based games with keyboard controls
  • Building accessible web interfaces with keyboard navigation
  • Implementing form validation and input restrictions
  • Developing interactive code editors and text manipulation tools
Best Practices

Using Modern Properties

The keyCode property is deprecated. It's recommended to use key or code properties instead for more reliable and semantically meaningful keyboard event handling.

Key vs Code

Use key when you care about the character being typed, and code when you care about the physical key position regardless of keyboard layout.

Accessibility Considerations

Always provide alternative ways to access functionality that uses keyboard shortcuts, and avoid conflicts with browser and screen reader keyboard shortcuts.