AbraCalc

Keyboard Tester

Test your keyboard and see the key, code and keyCode for any key you press.

Embed this tool on your site
Cite this tool

APA

AbraCalc. (2026). Keyboard Tester [Online calculator]. Retrieved from https://abracalc.com/device/keyboard-tester/

BibTeX

@misc{abracalc-keyboard-tester, author = {AbraCalc}, title = {Keyboard Tester}, year = {2026}, howpublished = {\url{https://abracalc.com/device/keyboard-tester/}} }

Did this tool answer your question?

How to use this tool

  1. Open this page — it runs instantly in your browser, no signup or install.
  2. Allow any permission prompt if asked; everything stays on your device.
  3. Use the on-screen controls — results update live.

Test your keyboard and see the key, code and keyCode for any key you press.

How it works

This tool listens for keyboard events in your browser and displays the key label, the event.key value (the logical key name), the event.code value (the physical key position), and the legacy event.keyCode integer for every key you press. All three values are shown simultaneously so you can compare them.

Key and code differ in an important way: event.key reflects what character the key produces given your current keyboard layout, while event.code identifies the physical position of the key on the keyboard regardless of layout. For example, pressing the Z key on a QWERTY keyboard gives key: z and code: KeyZ, but on an AZERTY layout the same physical key gives key: w and code: KeyZ.

This tool is useful for developers writing keyboard shortcut handlers, users testing whether a specific key registers correctly, and anyone diagnosing a stuck or mislabeled key on their keyboard.

Worked example

Find the keyCode for a special key to use in a script

  1. Open the tool.
  2. Press the key you need the code for (e.g., the F5 key).
  3. Read the 'keyCode' field in the displayed output.
  4. Use that integer (116 for F5) in your keyboard event handler.

The tool shows key: F5, code: F5, keyCode: 116, giving you all three identifiers needed for cross-browser compatibility.

Common mistakes to avoid

  • Using keyCode for letter keys in multilingual apps — the same keyCode maps to different characters across keyboard layouts, making event.key more reliable.
  • Expecting browser shortcut keys like Ctrl+Tab or Alt+F4 to appear — the browser consumes them before they reach the page.
  • Confusing event.code with event.key when writing layout-independent shortcuts — use event.code for position-based shortcuts and event.key for character-based ones.

Key terms

event.key
The logical value of the key pressed, reflecting the current keyboard layout and modifier state (e.g., 'A', 'Enter', 'ArrowLeft').
event.code
The physical location of the key on the keyboard, independent of layout (e.g., 'KeyA', 'Enter', 'ArrowLeft').
keyCode
A legacy integer property of keyboard events identifying the key. Deprecated in modern standards but still widely used in older code.

Frequently asked questions

Some keys do not appear when I press them — why?
The browser intercepts certain keys for its own shortcuts (e.g., Ctrl+T, Ctrl+W). These never reach JavaScript event listeners and cannot be detected by this tool.
Why does Shift+A show key 'A' (uppercase) but code 'KeyA'?
event.key includes modifier effects (so Shift changes a to A), while event.code always refers to the physical key regardless of modifiers.
Is keyCode reliable for detecting keys?
It works in practice but is officially deprecated. Prefer event.key or event.code in new code, as keyCode behavior varies across browsers for non-alphanumeric keys.

References & sources