Keyboard Event Tester

key, code, and modifiers.

Press any key or shortcut to see exactly what the browser reports: key, code, keyCode, location, repeat, and modifier state, plus a copy-ready event handler.

Zero retention: your data never leaves this browser. Verify it yourself in DevTools

Loading the toolbox.

About 2kbd

How Can You Verify That Nothing Leaves This Browser?

You do not have to take our word that your data stays here. Developer tools show every request a page makes, so you can watch this page work and confirm that nothing is sent. The check takes under a minute.

  1. Open your browser developer tools with F12, or Cmd+Option+I on a Mac, and select the Network tab.
  2. Reload the page and let it finish. You will see the page's own files, its web fonts, and one anonymous page-view request. Nothing has been typed yet, so none of them can contain your data.
  3. Click the clear icon in the Network tab so that the log is empty.
  4. Use the tool with your own input.
  5. Look at the Network tab again. It is still empty. For extra proof, turn on offline mode after the page loads and the tool keeps working.

Only two things can add a line to that log, and neither carries your data. Submitting the feedback form sends the vote and comment you typed. Typing characters in a script the page has not displayed yet, such as Cyrillic or Greek, can make the browser fetch the matching font file, and that request names only the font.

The production site also sends a Content-Security-Policy header that tells your browser to refuse connections to anywhere except this site and the anonymous analytics endpoint, so a coding mistake could not quietly send your data elsewhere.

What Is the Difference Between key and code?

event.key is the character or action the key produces with the current layout and modifiers: a, A, Enter, or ?. event.code names the physical key, regardless of layout: the key to the right of Tab is always KeyQ, even on a French AZERTY keyboard where it types A.

Match code for shortcuts that depend on position, such as WASD movement in a game. Match key when the character matters, such as ? to open help, so the shortcut works on every layout.

Should You Still Use keyCode?

No. keyCode and which are deprecated numeric codes that differ between browsers and layouts. They are shown for debugging old code, but new handlers should use key or code. The generated handler uses code by default and lets you switch to key.

What Else Does the Event Report?

  • location: whether a key is the left or right Shift, Ctrl, Alt, or Meta, or on the numeric keypad.
  • repeat: true when the key is held down and the event is an automatic repeat.
  • ctrlKey, shiftKey, altKey, metaKey: which modifiers were held. Meta is Cmd on a Mac and the Windows key on Windows.

Why Do Some Shortcuts Never Reach the Page?

The browser and operating system claim certain combinations before any web page sees them, such as Cmd+W, Cmd+Q, Ctrl+Tab, and Ctrl+Alt+Del. A page cannot override them and should not try. Choose shortcuts that do not collide with browser defaults, and remember that Tab still moves focus out of the capture area so the page stays accessible.

What Other Tools Are in the Checkers Lane?

  • 2xml: Format, minify, and validate XML with line and column errors, namespace lint, and JSON conversion.
  • 2jq: Try jq-style paths, pipes, select, length, and keys against JSON. A labeled subset, not full jq.
  • 2ssh: Validate ssh_config or sshd_config, copy a hardened block, and compose the right ssh-keygen command.
  • 2dotenv: Find duplicate keys, empty values, and quoting bugs, diff against .env.example, and generate one.

Elsewhere in the toolbox: 2uuid, 2gitignore, 2csp, 2htaccess, and more on the 2toolbox home page. Part of the 2suite.io privacy-first ecosystem.

Frequently Asked Questions

Are my keystrokes recorded or sent?

No. Key events are shown on this page and kept in a short list that disappears when you leave.

Why does Shift+2 show @ on one keyboard and " on another?

event.key follows the active layout. event.code is Digit2 on both.

How do I detect Cmd on Mac and Ctrl on Windows?

Check e.metaKey on macOS and e.ctrlKey elsewhere, or accept either for common shortcuts like save.

Why is keyCode 229 shown while typing in some languages?

An input method editor is composing text. Wait for the compositionend event before acting.

Was this helpful?