Docelora
ToolsAboutContact
Developer tools

JavaScript Keycode

Find the exact values to use in keyboard shortcuts and game controls – and see why event.code is usually better than the old keyCode.

Quick answer: click the box and press any key or combination. The values and a code snippet appear instantly, with a history of recent keys.

JavaScript Keycode

key · code · keyCode · snippet

Press a key
keyCode –

Recent keys

    Private: your code is processed in this browser tab and never uploaded.

    Common keys

    Keyevent.keyevent.codekeyCode
    EnterEnterEnter13
    EscapeEscapeEscape27
    Space" "Space32
    Left arrowArrowLeftArrowLeft37
    Aa or AKeyA65
    1 (top row)1Digit149

    Related tools

    Frequently asked questions

    What is the difference between event.key and event.code?

    event.key is the character or key name produced (affected by keyboard layout and Shift); event.code is the physical key position, the same on every layout.

    Is keyCode deprecated?

    Yes – keyCode and which are deprecated and inconsistent between browsers and layouts. Use event.key or event.code in new code.

    Which should I use for shortcuts?

    event.key for character shortcuts like Ctrl+S; event.code for position-based controls like WASD in games.

    What is event.location?

    0 standard, 1 left, 2 right and 3 numpad – it tells left and right Shift or numpad keys apart.

    Why do some keys not show?

    The browser or operating system reserves some keys (for example Windows key combinations or F11). Click the box first so it has focus.

    What is event.repeat?

    True when the key is held down and auto-repeating.

    Should I use keydown or keypress?

    keydown – keypress is deprecated.

    How do I detect Ctrl or Cmd?

    Check event.ctrlKey on Windows and Linux and event.metaKey on Mac.

    Why does event.key show “Dead”?

    Dead keys start an accented character on some layouts; the final character arrives with the next key.

    Does it work on phones?

    On-screen keyboards often report limited values (keyCode 229) – test with a physical keyboard for accurate results.

    Is this the same as the keyboard tester?

    No – the Keyboard tester checks that each key on your keyboard works; this tool shows developer event values.

    Is anything recorded?

    No – key presses are shown on this page only.

    Is it free?

    Yes – no sign-up, no limits and no watermark.

    Is my code uploaded?

    No. Everything runs in your browser; nothing you paste is sent to Docelora.

    Can I use the output in commercial projects?

    Yes. The output is yours to use however you like.

    Does it work on a phone or tablet?

    Yes – the layout adapts to small screens, though long code is easier to read on a larger display.

    How do I copy the result?

    Use the Copy button under the result, or Download to save it as a file.

    Which browsers are supported?

    Current versions of Chrome, Edge, Firefox and Safari.

    Is there a size limit?

    There is no fixed limit, but very large inputs can take a few seconds on older devices.

    Can I suggest an improvement?

    Yes – use the Contact page to tell us what would make the tool more useful.

    Last reviewed: 15 November 2026.