UTILSBOX⚡ALL TOOLS54+
JSON.FORMATHub of five tools: format, validate, minify, convert to XML, and compare two JSON documents.//REGEX.TESTERReal-time regular expressions tester, cheatsheet, debugger and replacer.//PDF.SUITEMerge, split, extract text, rotate and convert PDF pages to images.//IMAGE.STUDIOIn-browser photo editor: crop, resize, filters, WebP/PNG and Base64 encoder.//HTML.BEAUTIFYHTML code beautifier, production minifier and entity encoder.//CSS.MINIFYCSS code formatter, production stylesheet minifier and CSS to SCSS converter.//SQL.FORMATTERSQL query beautifier, dialect translator (Postgres/MySQL) and minifier.//SVG.EXCALIDRAWInteractive vector visual editor powered by Excalidraw and SVG formatter.//TEXT.DIFFWord counter, reading time estimator and dual-text diff comparator.//YAML.CONVERTYAML & JSON bi-directional validator and formatter with syntax checking.//XML.PARSERXML document formatter, tree inspector and XML to JSON converter.//GRAPHQL.STUDIOGraphQL query & SDL formatter, minifier, AST field sorter and validator.//BASE64.CODECBase64 and URL-Safe encoder / decoder with full UTF-8 verification.//PASSWORD.GENCryptographically secure random password and entropy strength generator.//URL.STUDIO8-tool URL suite: encode, decode, validator, component parser and builder.//QR.STUDIOCustom QR code generator with embedded logos, colors, gradients and shapes.//ASCII.EXPLORERInteractive ASCII 0-255 table, Alt keyboard codes and CP437 symbols.//KEYCODES.LIVELive KeyboardEvent detector and JavaScript keycodes cheat sheet.//JWT.DEBUGGERJWT token decoder, claims inspector and Web Crypto signature verification.//BINARY.CODECBidirectional text to binary converter with digital rain and ASCII table.//CHARTS.STUDIOInteractive chart generator (bars, lines, pie, scatter) from CSV data.//UUID.V7Bulk generator for UUID v4, time-ordered v7, v1 and live UUID validator.//CSV.JSONBi-directional CSV to JSON converter with custom delimiters & table grid.//COLORS.STUDIOHEX/RGB/HSL/CMYK converter, palette harmonies and WCAG 2.1 contrast tester.//SEO.METASEO Meta Tags, Open Graph cards and real-time Google SERP card preview.//SCHEMA.JSONLDSchema.org JSON-LD structured data generator for Google Rich Snippets.//SITEMAP.XMLStandard XML Sitemap generator (Protocol 0.9) for Google Search Console.//ROBOTS.TXTRobots.txt generator, AI scraper blocking presets and live URL rule tester.//FAKE.DATASynthetic mock data generator: export records to JSON, CSV, SQL and TypeScript.//CLOCK.WORLDReal-time world clock with 3D holographic globe and 174 country timezones.//DATE.CALCDays between dates, exact age, business days, Unix timestamp and cron parser.//CALC.SUITESuite of 56+ online calculators: percentage, mortgage, loan, VAT, BMI & salary.//JSON.FORMATHub of five tools: format, validate, minify, convert to XML, and compare two JSON documents.//REGEX.TESTERReal-time regular expressions tester, cheatsheet, debugger and replacer.//PDF.SUITEMerge, split, extract text, rotate and convert PDF pages to images.//IMAGE.STUDIOIn-browser photo editor: crop, resize, filters, WebP/PNG and Base64 encoder.//HTML.BEAUTIFYHTML code beautifier, production minifier and entity encoder.//CSS.MINIFYCSS code formatter, production stylesheet minifier and CSS to SCSS converter.//SQL.FORMATTERSQL query beautifier, dialect translator (Postgres/MySQL) and minifier.//SVG.EXCALIDRAWInteractive vector visual editor powered by Excalidraw and SVG formatter.//TEXT.DIFFWord counter, reading time estimator and dual-text diff comparator.//YAML.CONVERTYAML & JSON bi-directional validator and formatter with syntax checking.//XML.PARSERXML document formatter, tree inspector and XML to JSON converter.//GRAPHQL.STUDIOGraphQL query & SDL formatter, minifier, AST field sorter and validator.//BASE64.CODECBase64 and URL-Safe encoder / decoder with full UTF-8 verification.//PASSWORD.GENCryptographically secure random password and entropy strength generator.//URL.STUDIO8-tool URL suite: encode, decode, validator, component parser and builder.//QR.STUDIOCustom QR code generator with embedded logos, colors, gradients and shapes.//ASCII.EXPLORERInteractive ASCII 0-255 table, Alt keyboard codes and CP437 symbols.//KEYCODES.LIVELive KeyboardEvent detector and JavaScript keycodes cheat sheet.//JWT.DEBUGGERJWT token decoder, claims inspector and Web Crypto signature verification.//BINARY.CODECBidirectional text to binary converter with digital rain and ASCII table.//CHARTS.STUDIOInteractive chart generator (bars, lines, pie, scatter) from CSV data.//UUID.V7Bulk generator for UUID v4, time-ordered v7, v1 and live UUID validator.//CSV.JSONBi-directional CSV to JSON converter with custom delimiters & table grid.//COLORS.STUDIOHEX/RGB/HSL/CMYK converter, palette harmonies and WCAG 2.1 contrast tester.//SEO.METASEO Meta Tags, Open Graph cards and real-time Google SERP card preview.//SCHEMA.JSONLDSchema.org JSON-LD structured data generator for Google Rich Snippets.//SITEMAP.XMLStandard XML Sitemap generator (Protocol 0.9) for Google Search Console.//ROBOTS.TXTRobots.txt generator, AI scraper blocking presets and live URL rule tester.//FAKE.DATASynthetic mock data generator: export records to JSON, CSV, SQL and TypeScript.//CLOCK.WORLDReal-time world clock with 3D holographic globe and 174 country timezones.//DATE.CALCDays between dates, exact age, business days, Unix timestamp and cron parser.//CALC.SUITESuite of 56+ online calculators: percentage, mortgage, loan, VAT, BMI & salary.//
MODULE 17 · DEV

Key Event Codes & JavaScript KeyCode

JavaScript assigns numeric codes and properties to keyboard keys. Press any key to capture its real-time KeyboardEvent values.

Press any key...
⇧ ShiftCtrlAlt⌘ Cmd
KEY-
CODE-
WHICH/KEYCODE (DEPRECATED)-
KEY NAME-
Click inside the display area and press any key — runs 100% in your browser, zero network requests.

Reference Table (keyCode)

deprecated, but still supported across all web browsers
8Backspace
9Tab
13Enter
16Shift
17Ctrl
18Alt
19Pause/Break
20Caps Lock
27Escape
32Space
33Page Up
34Page Down
35End
36Home
37Left Arrow
38Up Arrow
39Right Arrow
40Down Arrow
45Insert
46Delete
48Number 0
49Number 1
50Number 2
51Number 3
52Number 4
53Number 5
54Number 6
55Number 7
56Number 8
57Number 9
65Letter A
66Letter B
67Letter C
68Letter D
69Letter E
70Letter F
71Letter G
72Letter H
73Letter I
74Letter J
75Letter K
76Letter L
77Letter M
78Letter N
79Letter O
80Letter P
81Letter Q
82Letter R
83Letter S
84Letter T
85Letter U
86Letter V
87Letter W
88Letter X
89Letter Y
90Letter Z
91Left Windows/Cmd
92Right Windows
93Menu/Select
96Numpad 0
97Numpad 1
98Numpad 2
99Numpad 3
100Numpad 4
101Numpad 5
102Numpad 6
103Numpad 7
104Numpad 8
105Numpad 9
106Multiply
107Add
109Subtract
110Decimal Point
111Divide
112F1
113F2
114F3
115F4
116F5
117F6
118F7
119F8
120F9
121F10
122F11
123F12
144Num Lock
145Scroll Lock
186Semicolon ;
187Equal =
188Comma ,
189Dash -
190Period .
191Forward Slash /
192Grave Accent `
219Open Bracket [
220Backslash \
221Close Bracket ]
222Single Quote '
// Technical guide & specifications

Technical guide: KeyboardEvent in the UI Events spec and life after keyCode

When to read key, when to read code, and how shortcuts survive AZERTY layouts, the numeric keypad and IME composition.

1. Why keyCode became a legacy property

The W3C UI Events specification keeps KeyboardEvent.keyCode and KeyboardEvent.which only as legacy properties, documented for compatibility. The core problem is that no common table ever existed: the ";" key reports 186 in Chrome, Edge and Safari but 59 in historical Firefox, and browsers return 0 for many keys inside the keypress event, which is deprecated as well. The standardized replacements are key, holding the effective character or the action name, and code, holding the physical key identifier; both draw from closed value lists in the "KeyboardEvent key Values" and "KeyboardEvent code Values" specifications. For text that is actually being inserted, listen to beforeinput or input instead of inferring characters from keydown.

2. event.key versus event.code: meaning or position

code identifies the physical position using the US QWERTY board as its reference: the leftmost key of the home row always reports KeyA, even when a French AZERTY prints Q on it and a German QWERTZ swaps Y and Z. key instead returns whatever the active layout produces right now: "a" without Shift, "A" with Shift and "q" on AZERTY. That is why WASD game controls are read from code (KeyW, KeyA, KeyS, KeyD) while semantic shortcuts are read from key (Enter, Escape, ArrowUp). The numeric keypad makes the split obvious: the keypad 1 carries code Numpad1 and the top-row 1 carries Digit1, yet both report key "1".

3. Modifiers, auto-repeat, location and isComposing

KeyboardEvent exposes boolean flags for ctrlKey, shiftKey, altKey and metaKey (Command on macOS, the Windows key on PC), and getModifierState() reports states without a dedicated flag, such as CapsLock, NumLock or AltGraph. The repeat property is true on the keydown events the operating system generates while a key is held, which is what stops an action from firing hundreds of times. location separates duplicated keys (0 standard, 1 left, 2 right, 3 numpad), the same distinction code makes with ShiftLeft and ShiftRight. And isComposing signals an in-progress composition in a Japanese, Chinese or Korean IME: while it is true, avoid intercepting keys, because Enter confirms a candidate instead of submitting the form.

// Architecture & best practices

❓ Frequently asked questions about keyboard events

Why does event.keyCode return 229 on Android or with an IME active?

229 is the "processed" sentinel browsers send when the input method editor or a mobile predictive keyboard consumes the keystroke; key arrives as Unidentified in that case. You cannot recover the character from keydown: read it from the beforeinput and input events or from the field value, and wait for isComposing to return to false or for compositionend to fire.

Why does my Ctrl+S shortcut break on a different keyboard layout?

If you compare against event.key, the value shifts with the layout and with modifiers: Shift delivers "S" and AltGr can deliver another character entirely. For position-bound shortcuts use event.code === "KeyS"; if you need the letter, normalize with key.toLowerCase(). Note as well that Windows reports AltGr as ctrlKey and altKey simultaneously, which can trigger Ctrl+Alt shortcuts by accident.

Why do some keys never fire keyup on macOS?

While the Command key is held down, macOS does not deliver keyup for the other keys, so a set of currently pressed keys drifts out of sync. keyup is also missing when the window loses focus mid-combination. The usual fix is to clear the active key set on the blur and visibilitychange events rather than relying on keyup alone.

Related developer tools