keecode logokeecode

Shift

16

shift

event.keyCode

16

event.key

Shift

event.code

ShiftLeft

Unicode

Code Examples

Copy and paste these examples to detect the Shift key in your JavaScript code

Recommended modern approach

// Modern approach (recommended)
document.addEventListener('keydown', (e) => {
  if (e.key === 'Shift') {
    console.log('Shift key pressed!');
    // Your code here
  }
});

Common Use Cases

How the Shift key is typically used in web applications

Text Selection

Select text while navigating with arrow keys

Reverse Tab

Move focus backward with Shift+Tab

Range Selection

Select ranges of items in lists

Related Keys

Other keys commonly used together or in similar contexts