---
name: "SDL_Scancode"
section: "3type"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_Scancode"
---

# SDL\_Scancode(3type)

The SDL keyboard scancode representation.

## NAME

SDL\_Scancode - The SDL keyboard scancode representation.

## HEADER FILE

Defined in SDL3/SDL\_scancode.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**typedef enum SDL\_Scancode** **{**     **SDL\_SCANCODE\_UNKNOWN = 0,**     **/\*\***      **\*  0me Usage page 0x07**      **\***      **\*  These values are from usage page 0x07 (USB keyboard page).**      **\*/**     **/\* @{ \*/**     **SDL\_SCANCODE\_A = 4,**     **SDL\_SCANCODE\_B = 5,**     **SDL\_SCANCODE\_C = 6,**     **SDL\_SCANCODE\_D = 7,**     **SDL\_SCANCODE\_E = 8,**     **SDL\_SCANCODE\_F = 9,**     **SDL\_SCANCODE\_G = 10,**     **SDL\_SCANCODE\_H = 11,**     **SDL\_SCANCODE\_I = 12,**     **SDL\_SCANCODE\_J = 13,**     **SDL\_SCANCODE\_K = 14,**     **SDL\_SCANCODE\_L = 15,**     **SDL\_SCANCODE\_M = 16,**     **SDL\_SCANCODE\_N = 17,**     **SDL\_SCANCODE\_O = 18,**     **SDL\_SCANCODE\_P = 19,**     **SDL\_SCANCODE\_Q = 20,**     **SDL\_SCANCODE\_R = 21,**     **SDL\_SCANCODE\_S = 22,**     **SDL\_SCANCODE\_T = 23,**     **SDL\_SCANCODE\_U = 24,**     **SDL\_SCANCODE\_V = 25,**     **SDL\_SCANCODE\_W = 26,**     **SDL\_SCANCODE\_X = 27,**     **SDL\_SCANCODE\_Y = 28,**     **SDL\_SCANCODE\_Z = 29,**     **SDL\_SCANCODE\_1 = 30,**     **SDL\_SCANCODE\_2 = 31,**     **SDL\_SCANCODE\_3 = 32,**     **SDL\_SCANCODE\_4 = 33,**     **SDL\_SCANCODE\_5 = 34,**     **SDL\_SCANCODE\_6 = 35,**     **SDL\_SCANCODE\_7 = 36,**     **SDL\_SCANCODE\_8 = 37,**     **SDL\_SCANCODE\_9 = 38,**     **SDL\_SCANCODE\_0 = 39,**     **SDL\_SCANCODE\_RETURN = 40,**     **SDL\_SCANCODE\_ESCAPE = 41,**     **SDL\_SCANCODE\_BACKSPACE = 42,**     **SDL\_SCANCODE\_TAB = 43,**     **SDL\_SCANCODE\_SPACE = 44,**     **SDL\_SCANCODE\_MINUS = 45,**     **SDL\_SCANCODE\_EQUALS = 46,**     **SDL\_SCANCODE\_LEFTBRACKET = 47,**     **SDL\_SCANCODE\_RIGHTBRACKET = 48,**     **SDL\_SCANCODE\_BACKSLASH = 49, /\*\*\< Located at the lower left of the return**                                   **\*   key on ISO keyboards and at the right end**                                   **\*   of the QWERTY row on ANSI keyboards.**                                   **\*   Produces REVERSE SOLIDUS (backslash) and**                                   **\*   VERTICAL LINE in a US layout, REVERSE**                                   **\*   SOLIDUS and VERTICAL LINE in a UK Mac**                                   **\*   layout, NUMBER SIGN and TILDE in a UK**                                   **\*   Windows layout, DOLLAR SIGN and POUND SIGN**                                   **\*   in a Swiss German layout, NUMBER SIGN and**                                   **\*   APOSTROPHE in a German layout, GRAVE**                                   **\*   ACCENT and POUND SIGN in a French Mac**                                   **\*   layout, and ASTERISK and MICRO SIGN in a**                                   **\*   French Windows layout.**                                   **\*/**     **SDL\_SCANCODE\_NONUSHASH = 50, /\*\*\< ISO USB keyboards actually use this code**                                   **\*   instead of 49 for the same key, but all**                                   **\*   OSes I've seen treat the two codes**                                   **\*   identically. So, as an implementor, unless**                                   **\*   your keyboard generates both of those**                                   **\*   codes and your OS treats them differently,**                                   **\*   you should generate SDL\_SCANCODE\_BACKSLASH**                                   **\*   instead of this code. As a user, you**                                   **\*   should not rely on this code because SDL**                                   **\*   will never generate it with most (all?)**                                   **\*   keyboards.**                                   **\*/**     **SDL\_SCANCODE\_SEMICOLON = 51,**     **SDL\_SCANCODE\_APOSTROPHE = 52,**     **SDL\_SCANCODE\_GRAVE = 53, /\*\*\< Located in the top left corner (on both ANSI**                               **\*   and ISO keyboards). Produces GRAVE ACCENT and**                               **\*   TILDE in a US Windows layout and in US and UK**                               **\*   Mac layouts on ANSI keyboards, GRAVE ACCENT**                               **\*   and NOT SIGN in a UK Windows layout, SECTION**                               **\*   SIGN and PLUS-MINUS SIGN in US and UK Mac**                               **\*   layouts on ISO keyboards, SECTION SIGN and**                               **\*   DEGREE SIGN in a Swiss German layout (Mac:**                               **\*   only on ISO keyboards), CIRCUMFLEX ACCENT and**                               **\*   DEGREE SIGN in a German layout (Mac: only on**                               **\*   ISO keyboards), SUPERSCRIPT TWO and TILDE in a**                               **\*   French Windows layout, COMMERCIAL AT and**                               **\*   NUMBER SIGN in a French Mac layout on ISO**                               **\*   keyboards, and LESS-THAN SIGN and GREATER-THAN**                               **\*   SIGN in a Swiss German, German, or French Mac**                               **\*   layout on ANSI keyboards.**                               **\*/**     **SDL\_SCANCODE\_COMMA = 54,**     **SDL\_SCANCODE\_PERIOD = 55,**     **SDL\_SCANCODE\_SLASH = 56,**     **SDL\_SCANCODE\_CAPSLOCK = 57,**     **SDL\_SCANCODE\_F1 = 58,**     **SDL\_SCANCODE\_F2 = 59,**     **SDL\_SCANCODE\_F3 = 60,**     **SDL\_SCANCODE\_F4 = 61,**     **SDL\_SCANCODE\_F5 = 62,**     **SDL\_SCANCODE\_F6 = 63,**     **SDL\_SCANCODE\_F7 = 64,**     **SDL\_SCANCODE\_F8 = 65,**     **SDL\_SCANCODE\_F9 = 66,**     **SDL\_SCANCODE\_F10 = 67,**     **SDL\_SCANCODE\_F11 = 68,**     **SDL\_SCANCODE\_F12 = 69,**     **SDL\_SCANCODE\_PRINTSCREEN = 70,**     **SDL\_SCANCODE\_SCROLLLOCK = 71,**     **SDL\_SCANCODE\_PAUSE = 72,**     **SDL\_SCANCODE\_INSERT = 73, /\*\*\< insert on PC, help on some Mac keyboards (but**                                    **does send code 73, not 117) \*/**     **SDL\_SCANCODE\_HOME = 74,**     **SDL\_SCANCODE\_PAGEUP = 75,**     **SDL\_SCANCODE\_DELETE = 76,**     **SDL\_SCANCODE\_END = 77,**     **SDL\_SCANCODE\_PAGEDOWN = 78,**     **SDL\_SCANCODE\_RIGHT = 79,**     **SDL\_SCANCODE\_LEFT = 80,**     **SDL\_SCANCODE\_DOWN = 81,**     **SDL\_SCANCODE\_UP = 82,**     **SDL\_SCANCODE\_NUMLOCKCLEAR = 83, /\*\*\< num lock on PC, clear on Mac keyboards**                                      **\*/**     **SDL\_SCANCODE\_KP\_DIVIDE = 84,**     **SDL\_SCANCODE\_KP\_MULTIPLY = 85,**     **SDL\_SCANCODE\_KP\_MINUS = 86,**     **SDL\_SCANCODE\_KP\_PLUS = 87,**     **SDL\_SCANCODE\_KP\_ENTER = 88,**     **SDL\_SCANCODE\_KP\_1 = 89,**     **SDL\_SCANCODE\_KP\_2 = 90,**     **SDL\_SCANCODE\_KP\_3 = 91,**     **SDL\_SCANCODE\_KP\_4 = 92,**     **SDL\_SCANCODE\_KP\_5 = 93,**     **SDL\_SCANCODE\_KP\_6 = 94,**     **SDL\_SCANCODE\_KP\_7 = 95,**     **SDL\_SCANCODE\_KP\_8 = 96,**     **SDL\_SCANCODE\_KP\_9 = 97,**     **SDL\_SCANCODE\_KP\_0 = 98,**     **SDL\_SCANCODE\_KP\_PERIOD = 99,**     **SDL\_SCANCODE\_NONUSBACKSLASH = 100, /\*\*\< This is the additional key that ISO**                                         **\*   keyboards have over ANSI ones,**                                         **\*   located between left shift and Y.**                                         **\*   Produces GRAVE ACCENT and TILDE in a**                                         **\*   US or UK Mac layout, REVERSE SOLIDUS**                                         **\*   (backslash) and VERTICAL LINE in a**                                         **\*   US or UK Windows layout, and**                                         **\*   LESS-THAN SIGN and GREATER-THAN SIGN**                                         **\*   in a Swiss German, German, or French**                                         **\*   layout. \*/**     **SDL\_SCANCODE\_APPLICATION = 101, /\*\*\< windows contextual menu, compose \*/**     **SDL\_SCANCODE\_POWER = 102, /\*\*\< The USB document says this is a status flag,**                                **\*   not a physical key - but some Mac keyboards**                                **\*   do have a power key. \*/**     **SDL\_SCANCODE\_KP\_EQUALS = 103,**     **SDL\_SCANCODE\_F13 = 104,**     **SDL\_SCANCODE\_F14 = 105,**     **SDL\_SCANCODE\_F15 = 106,**     **SDL\_SCANCODE\_F16 = 107,**     **SDL\_SCANCODE\_F17 = 108,**     **SDL\_SCANCODE\_F18 = 109,**     **SDL\_SCANCODE\_F19 = 110,**     **SDL\_SCANCODE\_F20 = 111,**     **SDL\_SCANCODE\_F21 = 112,**     **SDL\_SCANCODE\_F22 = 113,**     **SDL\_SCANCODE\_F23 = 114,**     **SDL\_SCANCODE\_F24 = 115,**     **SDL\_SCANCODE\_EXECUTE = 116,**     **SDL\_SCANCODE\_HELP = 117,    /\*\*\< AL Integrated Help Center \*/**     **SDL\_SCANCODE\_MENU = 118,    /\*\*\< Menu (show menu) \*/**     **SDL\_SCANCODE\_SELECT = 119,**     **SDL\_SCANCODE\_STOP = 120,    /\*\*\< AC Stop \*/**     **SDL\_SCANCODE\_AGAIN = 121,   /\*\*\< AC Redo/Repeat \*/**     **SDL\_SCANCODE\_UNDO = 122,    /\*\*\< AC Undo \*/**     **SDL\_SCANCODE\_CUT = 123,     /\*\*\< AC Cut \*/**     **SDL\_SCANCODE\_COPY = 124,    /\*\*\< AC Copy \*/**     **SDL\_SCANCODE\_PASTE = 125,   /\*\*\< AC Paste \*/**     **SDL\_SCANCODE\_FIND = 126,    /\*\*\< AC Find \*/**     **SDL\_SCANCODE\_MUTE = 127,**     **SDL\_SCANCODE\_VOLUMEUP = 128,**     **SDL\_SCANCODE\_VOLUMEDOWN = 129,** **/\* not sure whether there's a reason to enable these \*/** **/\*     SDL\_SCANCODE\_LOCKINGCAPSLOCK = 130,  \*/** **/\*     SDL\_SCANCODE\_LOCKINGNUMLOCK = 131, \*/** **/\*     SDL\_SCANCODE\_LOCKINGSCROLLLOCK = 132, \*/**     **SDL\_SCANCODE\_KP\_COMMA = 133,**     **SDL\_SCANCODE\_KP\_EQUALSAS400 = 134,**     **SDL\_SCANCODE\_INTERNATIONAL1 = 135, /\*\*\< used on Asian keyboards, see**                                             **footnotes in USB doc \*/**     **SDL\_SCANCODE\_INTERNATIONAL2 = 136,**     **SDL\_SCANCODE\_INTERNATIONAL3 = 137, /\*\*\< Yen \*/**     **SDL\_SCANCODE\_INTERNATIONAL4 = 138,**     **SDL\_SCANCODE\_INTERNATIONAL5 = 139,**     **SDL\_SCANCODE\_INTERNATIONAL6 = 140,**     **SDL\_SCANCODE\_INTERNATIONAL7 = 141,**     **SDL\_SCANCODE\_INTERNATIONAL8 = 142,**     **SDL\_SCANCODE\_INTERNATIONAL9 = 143,**     **SDL\_SCANCODE\_LANG1 = 144, /\*\*\< Hangul/English toggle \*/**     **SDL\_SCANCODE\_LANG2 = 145, /\*\*\< Hanja conversion \*/**     **SDL\_SCANCODE\_LANG3 = 146, /\*\*\< Katakana \*/**     **SDL\_SCANCODE\_LANG4 = 147, /\*\*\< Hiragana \*/**     **SDL\_SCANCODE\_LANG5 = 148, /\*\*\< Zenkaku/Hankaku \*/**     **SDL\_SCANCODE\_LANG6 = 149, /\*\*\< reserved \*/**     **SDL\_SCANCODE\_LANG7 = 150, /\*\*\< reserved \*/**     **SDL\_SCANCODE\_LANG8 = 151, /\*\*\< reserved \*/**     **SDL\_SCANCODE\_LANG9 = 152, /\*\*\< reserved \*/**     **SDL\_SCANCODE\_ALTERASE = 153,    /\*\*\< Erase-Eaze \*/**     **SDL\_SCANCODE\_SYSREQ = 154,**     **SDL\_SCANCODE\_CANCEL = 155,      /\*\*\< AC Cancel \*/**     **SDL\_SCANCODE\_CLEAR = 156,**     **SDL\_SCANCODE\_PRIOR = 157,**     **SDL\_SCANCODE\_RETURN2 = 158,**     **SDL\_SCANCODE\_SEPARATOR = 159,**     **SDL\_SCANCODE\_OUT = 160,**     **SDL\_SCANCODE\_OPER = 161,**     **SDL\_SCANCODE\_CLEARAGAIN = 162,**     **SDL\_SCANCODE\_CRSEL = 163,**     **SDL\_SCANCODE\_EXSEL = 164,**     **SDL\_SCANCODE\_KP\_00 = 176,**     **SDL\_SCANCODE\_KP\_000 = 177,**     **SDL\_SCANCODE\_THOUSANDSSEPARATOR = 178,**     **SDL\_SCANCODE\_DECIMALSEPARATOR = 179,**     **SDL\_SCANCODE\_CURRENCYUNIT = 180,**     **SDL\_SCANCODE\_CURRENCYSUBUNIT = 181,**     **SDL\_SCANCODE\_KP\_LEFTPAREN = 182,**     **SDL\_SCANCODE\_KP\_RIGHTPAREN = 183,**     **SDL\_SCANCODE\_KP\_LEFTBRACE = 184,**     **SDL\_SCANCODE\_KP\_RIGHTBRACE = 185,**     **SDL\_SCANCODE\_KP\_TAB = 186,**     **SDL\_SCANCODE\_KP\_BACKSPACE = 187,**     **SDL\_SCANCODE\_KP\_A = 188,**     **SDL\_SCANCODE\_KP\_B = 189,**     **SDL\_SCANCODE\_KP\_C = 190,**     **SDL\_SCANCODE\_KP\_D = 191,**     **SDL\_SCANCODE\_KP\_E = 192,**     **SDL\_SCANCODE\_KP\_F = 193,**     **SDL\_SCANCODE\_KP\_XOR = 194,**     **SDL\_SCANCODE\_KP\_POWER = 195,**     **SDL\_SCANCODE\_KP\_PERCENT = 196,**     **SDL\_SCANCODE\_KP\_LESS = 197,**     **SDL\_SCANCODE\_KP\_GREATER = 198,**     **SDL\_SCANCODE\_KP\_AMPERSAND = 199,**     **SDL\_SCANCODE\_KP\_DBLAMPERSAND = 200,**     **SDL\_SCANCODE\_KP\_VERTICALBAR = 201,**     **SDL\_SCANCODE\_KP\_DBLVERTICALBAR = 202,**     **SDL\_SCANCODE\_KP\_COLON = 203,**     **SDL\_SCANCODE\_KP\_HASH = 204,**     **SDL\_SCANCODE\_KP\_SPACE = 205,**     **SDL\_SCANCODE\_KP\_AT = 206,**     **SDL\_SCANCODE\_KP\_EXCLAM = 207,**     **SDL\_SCANCODE\_KP\_MEMSTORE = 208,**     **SDL\_SCANCODE\_KP\_MEMRECALL = 209,**     **SDL\_SCANCODE\_KP\_MEMCLEAR = 210,**     **SDL\_SCANCODE\_KP\_MEMADD = 211,**     **SDL\_SCANCODE\_KP\_MEMSUBTRACT = 212,**     **SDL\_SCANCODE\_KP\_MEMMULTIPLY = 213,**     **SDL\_SCANCODE\_KP\_MEMDIVIDE = 214,**     **SDL\_SCANCODE\_KP\_PLUSMINUS = 215,**     **SDL\_SCANCODE\_KP\_CLEAR = 216,**     **SDL\_SCANCODE\_KP\_CLEARENTRY = 217,**     **SDL\_SCANCODE\_KP\_BINARY = 218,**     **SDL\_SCANCODE\_KP\_OCTAL = 219,**     **SDL\_SCANCODE\_KP\_DECIMAL = 220,**     **SDL\_SCANCODE\_KP\_HEXADECIMAL = 221,**     **SDL\_SCANCODE\_LCTRL = 224,**     **SDL\_SCANCODE\_LSHIFT = 225,**     **SDL\_SCANCODE\_LALT = 226, /\*\*\< alt, option \*/**     **SDL\_SCANCODE\_LGUI = 227, /\*\*\< windows, command (apple), meta \*/**     **SDL\_SCANCODE\_RCTRL = 228,**     **SDL\_SCANCODE\_RSHIFT = 229,**     **SDL\_SCANCODE\_RALT = 230, /\*\*\< alt gr, option \*/**     **SDL\_SCANCODE\_RGUI = 231, /\*\*\< windows, command (apple), meta \*/**     **SDL\_SCANCODE\_MODE = 257,    /\*\*\< I'm not sure if this is really not covered**                                  **\*   by any of the above, but since there's a**                                  **\*   special SDL\_KMOD\_MODE for it I'm adding it here**                                  **\*/**     **/\* @} \*//\* Usage page 0x07 \*/**     **/\*\***      **\*  0me Usage page 0x0C**      **\***      **\*  These values are mapped from usage page 0x0C (USB consumer page).**      **\***      **\*  There are way more keys in the spec than we can represent in the**      **\*  current scancode range, so pick the ones that commonly come up in**      **\*  real world usage.**      **\*/**     **/\* @{ \*/**     **SDL\_SCANCODE\_SLEEP = 258,                   /\*\*\< Sleep \*/**     **SDL\_SCANCODE\_WAKE = 259,                    /\*\*\< Wake \*/**     **SDL\_SCANCODE\_CHANNEL\_INCREMENT = 260,       /\*\*\< Channel Increment \*/**     **SDL\_SCANCODE\_CHANNEL\_DECREMENT = 261,       /\*\*\< Channel Decrement \*/**     **SDL\_SCANCODE\_MEDIA\_PLAY = 262,          /\*\*\< Play \*/**     **SDL\_SCANCODE\_MEDIA\_PAUSE = 263,         /\*\*\< Pause \*/**     **SDL\_SCANCODE\_MEDIA\_RECORD = 264,        /\*\*\< Record \*/**     **SDL\_SCANCODE\_MEDIA\_FAST\_FORWARD = 265,  /\*\*\< Fast Forward \*/**     **SDL\_SCANCODE\_MEDIA\_REWIND = 266,        /\*\*\< Rewind \*/**     **SDL\_SCANCODE\_MEDIA\_NEXT\_TRACK = 267,    /\*\*\< Next Track \*/**     **SDL\_SCANCODE\_MEDIA\_PREVIOUS\_TRACK = 268, /\*\*\< Previous Track \*/**     **SDL\_SCANCODE\_MEDIA\_STOP = 269,          /\*\*\< Stop \*/**     **SDL\_SCANCODE\_MEDIA\_EJECT = 270,         /\*\*\< Eject \*/**     **SDL\_SCANCODE\_MEDIA\_PLAY\_PAUSE = 271,    /\*\*\< Play / Pause \*/**     **SDL\_SCANCODE\_MEDIA\_SELECT = 272,        /\* Media Select \*/**     **SDL\_SCANCODE\_AC\_NEW = 273,              /\*\*\< AC New \*/**     **SDL\_SCANCODE\_AC\_OPEN = 274,             /\*\*\< AC Open \*/**     **SDL\_SCANCODE\_AC\_CLOSE = 275,            /\*\*\< AC Close \*/**     **SDL\_SCANCODE\_AC\_EXIT = 276,             /\*\*\< AC Exit \*/**     **SDL\_SCANCODE\_AC\_SAVE = 277,             /\*\*\< AC Save \*/**     **SDL\_SCANCODE\_AC\_PRINT = 278,            /\*\*\< AC Print \*/**     **SDL\_SCANCODE\_AC\_PROPERTIES = 279,       /\*\*\< AC Properties \*/**     **SDL\_SCANCODE\_AC\_SEARCH = 280,           /\*\*\< AC Search \*/**     **SDL\_SCANCODE\_AC\_HOME = 281,             /\*\*\< AC Home \*/**     **SDL\_SCANCODE\_AC\_BACK = 282,             /\*\*\< AC Back \*/**     **SDL\_SCANCODE\_AC\_FORWARD = 283,          /\*\*\< AC Forward \*/**     **SDL\_SCANCODE\_AC\_STOP = 284,             /\*\*\< AC Stop \*/**     **SDL\_SCANCODE\_AC\_REFRESH = 285,          /\*\*\< AC Refresh \*/**     **SDL\_SCANCODE\_AC\_BOOKMARKS = 286,        /\*\*\< AC Bookmarks \*/**     **/\* @} \*//\* Usage page 0x0C \*/**     **/\*\***      **\*  0me Mobile keys**      **\***      **\*  These are values that are often used on mobile phones.**      **\*/**     **/\* @{ \*/**     **SDL\_SCANCODE\_SOFTLEFT = 287, /\*\*\< Usually situated below the display on phones and**                                       **used as a multi-function feature key for selecting**                                       **a software defined function shown on the bottom left**                                       **of the display. \*/**     **SDL\_SCANCODE\_SOFTRIGHT = 288, /\*\*\< Usually situated below the display on phones and**                                        **used as a multi-function feature key for selecting**                                        **a software defined function shown on the bottom right**                                        **of the display. \*/**     **SDL\_SCANCODE\_CALL = 289, /\*\*\< Used for accepting phone calls. \*/**     **SDL\_SCANCODE\_ENDCALL = 290, /\*\*\< Used for rejecting phone calls. \*/**     **/\* @} \*//\* Mobile keys \*/**     **/\* Add any other keys here. \*/**     **SDL\_SCANCODE\_RESERVED = 400,    /\*\*\< 400-500 reserved for dynamic keycodes \*/**     **SDL\_SCANCODE\_COUNT = 512 /\*\*\< not a key, just marks the number of scancodes for array bounds \*/** **} SDL\_Scancode;**

## DESCRIPTION

An SDL scancode is the physical representation of a key on the keyboard, independent of language and keyboard mapping.

Values of this type are used to represent keyboard keys, among other places in the **scancode** field of the  **SDL\_KeyboardEvent**

structure.

The values in this enumeration are based on the USB usage page standard: https://usb.org/sites/default/files/hut1\_5.pdf

## AVAILABILITY

This enum is available since SDL 3.2.0.
