A Karabiner Elements Complex Modification that allows you to toggle Caps Lock by tapping either Shift key, while preserving normal Shift functionality when holding the keys down. This is particularly useful when you have remapped your Caps Lock key to other functions (like Escape or Hyper key) but still need occasional Caps Lock functionality.
-
Tap either Shift key: Toggles Caps Lock on/off
-
Hold either Shift key: Functions as normal Shift modifier
-
Immediate Shift response: Works instantly when combined with other keys
-
Configurable timing: 250ms threshold between tap and hold behavior
-
macOS with Karabiner Elements installed
-
Karabiner Elements version 13.0.0 or later (for
hold_down_millisecondssupport)
-
Open Karabiner Elements → Complex Modifications tab
-
Click Add your own rule button
-
Copy and paste the JSON configuration below into the editor
-
Click Save button
-
Enable the rule by clicking the Enable button
{
"description": "Tap Shift for Caps Lock, hold for normal Shift",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_shift",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"key_code": "left_shift",
"lazy": true
}
],
"to_if_alone": [
{
"key_code": "caps_lock",
"hold_down_milliseconds": 200
}
],
"to_if_held_down": [
{
"key_code": "right_shift"
}
],
"parameters": {
"basic.to_if_alone_timeout_milliseconds": 250,
"basic.to_if_held_down_threshold_milliseconds": 250
}
},
{
"type": "basic",
"from": {
"key_code": "right_shift",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"key_code": "right_shift",
"lazy": true
}
],
"to_if_alone": [
{
"key_code": "caps_lock",
"hold_down_milliseconds": 200
}
],
"to_if_held_down": [
{
"key_code": "right_shift"
}
],
"parameters": {
"basic.to_if_alone_timeout_milliseconds": 250,
"basic.to_if_held_down_threshold_milliseconds": 250
}
}
]
}{
"title": "Shift to Caps Lock Toggle",
"rules": [
{
"description": "Tap Shift for Caps Lock, hold for normal Shift",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_shift",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"key_code": "left_shift",
"lazy": true
}
],
"to_if_alone": [
{
"key_code": "caps_lock",
"hold_down_milliseconds": 200
}
],
"to_if_held_down": [
{
"key_code": "left_shift"
}
],
"parameters": {
"basic.to_if_alone_timeout_milliseconds": 250,
"basic.to_if_held_down_threshold_milliseconds": 250
}
},
{
"type": "basic",
"from": {
"key_code": "right_shift",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"key_code": "right_shift",
"lazy": true
}
],
"to_if_alone": [
{
"key_code": "caps_lock",
"hold_down_milliseconds": 200
}
],
"to_if_held_down": [
{
"key_code": "right_shift"
}
],
"parameters": {
"basic.to_if_alone_timeout_milliseconds": 250,
"basic.to_if_held_down_threshold_milliseconds": 250
}
}
]
}
]
}The modification uses several Karabiner Elements features:
lazy: true-
Prevents the Shift modifier from being sent immediately when pressed, allowing the tap/hold detection to work properly.
to_if_alone-
Triggered when a Shift key is pressed and released quickly (under 250ms threshold).
to_if_held_down-
Triggered when a Shift key is held down for longer than the threshold (250ms).
hold_down_milliseconds: 200-
Critical parameter that ensures the caps_lock key event is held down long enough for macOS to register the state change.
optional: ["any"]-
Allows the modification to work regardless of other modifier keys being pressed.
You can modify the timing parameters to suit your preferences:
-
Shorter timeout (e.g., 150ms): More responsive but may cause accidental caps lock activation
-
Longer timeout (e.g., 400ms): Less sensitive but may feel sluggish
If quick taps don’t toggle Caps Lock:
-
Verify
hold_down_millisecondsis set to 200 or higher -
Check that you’re using Karabiner Elements 13.0.0 or later
-
Ensure the "Disable the accidental keystroke prevention of Caps Lock" rule is enabled if you experience delays
If holding Shift doesn’t work for typing capitals:
-
Verify
lazy: trueis present in thetoarray -
Check that
to_if_held_downcontains the correct shift key -
Ensure timing parameters aren’t too aggressive
-
Users who have remapped Caps Lock to Escape (common in Vim workflows)
-
Users with Caps Lock mapped to Hyper key or other modifiers
-
Anyone who wants occasional Caps Lock access without dedicated key
-
Touch typists who prefer not to move hands to access Caps Lock
-
All macOS versions supported by Karabiner Elements
-
External and built-in keyboards
-
Other Karabiner Elements modifications (when properly configured)
-
Vim Mode Plus and similar applications
This configuration is released under the MIT License. Use and modify freely.
Created for Karabiner Elements community.