In JavaScript, the keyup event fires when a key is released (MDN). Pair it with keydown for press/release control. Prefer both over the Deprecatedkeypress event.
Register a listener with addEventListener. Check readiness and browser support before you rely on this event.
Check isComposing. True while an IME session is active.
No 229 check. MDN: keyup does not use that keydown marker.
Return early. Avoid treating composition releases as shortcuts.
Why it matters. Improves compatibility for CJKT text input.
Compatibility
Browser Support
Element keyup is Baseline Widely available (MDN: since July 2015). Safe for press/release UX in modern and older evergreen browsers.
✓ Baseline · Widely available
Element keyup
KeyboardEvent when a key is released — long-established across browsers.
99%Widely available
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
keyupBaseline
Bottom line: Prefer keydown/keyup over keypress. Use keyup to end holds; remember modifiers reflect post-release state.
Frequently Asked Questions
It fires when a key is released. Together with keydown it gives you a press/release pair for shortcuts, games, and held-key controls (MDN).
No. MDN marks Element keyup as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
A KeyboardEvent. Useful properties include key, code, altKey, ctrlKey, shiftKey, metaKey, and isComposing.
keydown fires when the key goes down (and may repeat while held). keyup fires once when the key is released. Start actions on keydown; stop or commit on keyup.
Yes. For Tab, keydown and keyup can target different elements because focus already moved (MDN).
Skip when event.isComposing is true. Unlike keydown, keyup does not use the special keyCode 229 IME marker (MDN).