Keyboard Event Codes
The complete set of KeyboardEvent.code values defined by the W3C UI Events specification. Each entry records the code string (e.g. KeyA, Digit1, ShiftLeft) that identifies the physical key regardless of keyboard layout, the typical key label or printed value, the physical location of the key (standard, left, right, or numpad), and a logical category grouping (alphanumeric, function, control, navigation, numpad, or modifier). The dataset has 184 codes: all 172 values in the W3C code registry (as of October 2026) plus F13–F24, including alphanumeric keys, function keys, modifier keys, navigation cluster, numpad, media, browser and legacy editing keys, and miscellaneous control keys.
Quick fetch
Stable URL. CORS-enabled. No auth.
curl https://staticdata.dev/v1/keyboard-event-codes.json
Or use as a typed import:
import { keyboardEventCodes } from "https://staticdata.dev/v1/keyboard-event-codes.ts"
Formats
- JSON 19.2 KB
/v1/keyboard-event-codes.json
min: 13.8 KB · /v1/keyboard-event-codes.min.json
- CSV 6.0 KB
/v1/keyboard-event-codes.csv
- TypeScript 19.5 KB
/v1/keyboard-event-codes.ts
export const keyboardEventCodes
type KeyboardCode = (typeof keyboardEventCodes)[number]
Schema
Each record in the dataset has the following shape.
| Field | Type | Description | Example |
|---|---|---|---|
| code | string | The KeyboardEvent.code string identifying the physical key | KeyA |
| key | string | Typical printed value or label produced by the key in unmodified state | a |
| location | string | Physical location on keyboard: standard, left, right, or numpad | standard |
| category | string | Logical grouping: alphanumeric, function, control, navigation, numpad, or modifier | alphanumeric |
Preview
First 10 records.
| code | key | location | category |
|---|---|---|---|
| Abort | Abort | standard | control |
| Again | Again | standard | control |
| AltLeft | Alt | left | modifier |
| AltRight | Alt | right | modifier |
| ArrowDown | ArrowDown | standard | navigation |
| ArrowLeft | ArrowLeft | standard | navigation |
| ArrowRight | ArrowRight | standard | navigation |
| ArrowUp | ArrowUp | standard | navigation |
| AudioVolumeDown | AudioVolumeDown | standard | control |
| AudioVolumeMute | AudioVolumeMute | standard | control |
Fetch examples
Drop-in snippets in five languages.
curl -sSL https://staticdata.dev/v1/keyboard-event-codes.json | jq '.[0]' import type { KeyboardCode } from "https://staticdata.dev/v1/keyboard-event-codes.ts";
const res = await fetch("https://staticdata.dev/v1/keyboard-event-codes.min.json");
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
const keyboardEventCodes: KeyboardCode[] = await res.json();
console.log(keyboardEventCodes[0]); import urllib.request, json
with urllib.request.urlopen("https://staticdata.dev/v1/keyboard-event-codes.min.json") as r:
keyboardEventCodes = json.load(r)
print(keyboardEventCodes[0]) package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://staticdata.dev/v1/keyboard-event-codes.min.json")
if err != nil { panic(err) }
defer resp.Body.Close()
var data []map[string]any
if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
panic(err)
}
fmt.Println(data[0])
} use serde_json::Value;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let body = ureq::get("https://staticdata.dev/v1/keyboard-event-codes.min.json").call()?.into_string()?;
let data: Vec<Value> = serde_json::from_str(&body)?;
println!("{:?}", data.first());
Ok(())
} Sources and methodology
The data is curated from the W3C UI Events KeyboardEvent code values specification. The KeyboardEvent.code property returns a string that identifies the physical key pressed on a keyboard, independent of the active keyboard layout or locale. This makes it ideal for game controls, keyboard shortcuts, and any scenario where physical key position matters more than the character produced.
Keys are grouped into six categories: alphanumeric covers the main letter, digit, and punctuation keys on the alphanumeric block; function covers the F1–F24 function row; modifier covers keys like Shift, Control, Alt, Meta, CapsLock, and Fn that modify the effect of other keys; control covers editing and system keys such as Enter, Backspace, Escape, Delete, Insert, Tab, and media/power keys; navigation covers the arrow keys and the navigation cluster (Home, End, PageUp, PageDown); and numpad covers all keys on the numeric keypad including NumLock.
The location field distinguishes keys that appear in multiple physical positions: left and right for paired modifier keys (e.g. ShiftLeft vs ShiftRight), numpad for numpad keys, and standard for all other keys. The key field reflects the value typically reported by KeyboardEvent.key when the key is pressed without modifiers and with a US English layout — for letter keys this is the lowercase character, for symbol keys it is the unshifted character, and for special keys it is the standard key value string defined by the W3C (e.g. LaunchApp1 → LaunchApplication1, MediaSelect → LaunchMediaPlayer). The legacy Abort, Resume and Suspend keys have no defined key value; their printed label is given. F13–F24 are not listed in the code registry tables but are emitted by browsers for extended function rows.
Versioning
URLs under /v1/ are stable: field names and types will not change in a way
that breaks consumers. Values can be corrected or records added when the upstream source
changes; schema-incompatible updates ship under a new version path. See the
keyboard-event-codes changelog for this dataset's history.
Related datasets
More Web datasets
- aria-attributes
- aria-roles
- character-encodings
- csp-directives
- credit-card-types
- dns-record-types
- emoji
- emoji-shortcodes
- html-elements
- html-entities
- html-attributes
- input-types
- http-auth-schemes
- http-cache-directives
- http-content-codings
- http-headers
- http-methods
- http-status-codes
- http-versions
- iframe-sandbox-tokens
- ip-protocol-numbers
- link-relations
- media-type-suffixes
- mime-types
- oauth-grant-types
- ports
- referrer-policies
- ip-special-blocks
- svg-elements
- tcp-flags
- tlds
- tls-cipher-suites
- tls-versions
- uri-schemes
- well-known-uris