# How to Lock Your Mac Keyboard for Cleaning

URL: https://www.raycast.com/guides/how-to-lock-your-keyboard-for-cleaning-on-mac
Published: 2026-11-26
Updated: 2026-11-26
Description: Wipe your keyboard without typing gibberish, launching apps or deleting files. How to lock a Mac keyboard for a set time with Raycast, plus Apple's own advice for cleaning it safely.

You grab a cloth to wipe the crumbs off your keyboard, and three seconds later you've renamed a file, sent a half-written message and opened Siri. Your Mac keeps listening while you clean.

**The short answer:** install the free [Clean Keyboard](https://www.raycast.com/ike-gg/clean-keyboard) extension for Raycast, run **Lock Keyboard** and pick how long, from 15 seconds to forever. Every key press is ignored while you clean, and `⌃` `U` unlocks it early. If you're doing a deep clean with a damp cloth, follow Apple's advice instead: shut down your Mac and unplug it first.

| Method                     | Screen stays usable | Unlock           | Best for                   |
| -------------------------- | ------------------- | ---------------- | -------------------------- |
| Clean Keyboard for Raycast | Yes                 | Timer or `⌃` `U` | A quick wipe               |
| Lock Screen                | No                  | Your password    | Keys go to the login field |
| Shut down                  | No                  | Turn it back on  | A deep clean               |

## Lock your keyboard with Raycast | The quickest way

### [Clean Keyboard: lock your keyboard while you wipe it](https://www.raycast.com/ike-gg/clean-keyboard)

Clean Keyboard is a free, open-source extension with more than 85,000 installs. It does one thing: it blocks your keyboard for as long as you choose.

1. Open Raycast and run **Lock Keyboard**.
2. Pick a duration: 15 seconds, 30 seconds, 1, 2 or 5 minutes, 1 hour, 24 hours, or **Forever**.
3. Clean away. Key presses do nothing while the lock is on.
4. The keyboard unlocks when the time is up. Press `⌃` `U` to unlock it sooner.

![Lock Keyboard asks how long to lock your keys, from 15 seconds to forever.](https://www.raycast.com/uploads/how-to-lock-your-keyboard-for-cleaning-on-mac/how-to-lock-your-keyboard-for-cleaning-on-mac.png)

> Pro tip: always picking the same time? Set **Default Duration** in the command's preferences, say to 30 seconds, and **Lock Keyboard** starts right away without asking.

A few things worth knowing:

- **Some keys can't be blocked.** macOS handles the `fn` key, media keys like volume and play, and the Touch ID button itself, so they still work. On macOS Tahoe and later, turn on **Lock Function Row Keys** in the preferences to block the function row as well.
- **Lock the trackpad too.** Turn on **Lock Mouse Clicks** to block clicks and dragging while you wipe the trackpad. Scrolling and the pointer still move. This option needs Touch ID: press `⌃` `U`, or tap either `⌘` key three times, to unlock with your fingerprint. In a pinch, holding both `⌘` keys for eight seconds forces the lock off.
- **Just ask.** In [Raycast AI](https://manual.raycast.com/ai/ai-extensions), type `@clean-keyboard` and ask it to lock your keyboard for 30 seconds.

Clean Keyboard works on Windows too, where it locks the keyboard the same way.

## Lock the screen | Built in: Lock Screen

macOS has no keyboard lock, but locking the screen comes close. Press `⌃` `⌘` `Q`, or choose **Apple menu → Lock Screen**.

With the screen locked, whatever you press lands in the password field instead of your open apps, so your documents are safe. It's not perfect: you might trigger a few failed password attempts, the volume and brightness keys still work, and you have to sign back in afterwards.

## Shut down for a deep clean | Apple's recommendation

For anything more than a dry wipe, Apple's guidance is to turn off your Mac and unplug it before cleaning. Then:

- Use a **soft, lint-free cloth**. If you need it, dampen it slightly with water. Don't spray anything directly onto the keyboard.
- To disinfect, you can use a **70 percent isopropyl alcohol wipe** on the keys. Avoid bleach, hydrogen peroxide and abrasive cleaners.
- Don't let moisture get into openings, and let everything dry before you turn your Mac back on.

For crumbs under the keys, hold your MacBook at an angle and gently use compressed air.

## New to Raycast?

Here's a quick tour of what else it can do, in under seven minutes:

[Video: 102 Things You Can Do With Raycast 2.0](https://www.youtube.com/watch?v=G7_7F_FBqQE)

## Frequently Asked Questions

### Can I lock my Mac keyboard without locking the screen?

Not with macOS alone. A tool like Raycast's free Clean Keyboard extension blocks key presses for a set time while the screen stays on and unlocked. Press `⌃` `U` to end it early.

### Does locking the screen stop key presses?

Mostly. With the screen locked, keys go to the password field instead of your apps, so nothing gets typed into your documents. You may still trigger failed password attempts, and media keys like volume still work.

### Which keys still work while the keyboard is locked?

macOS handles some keys itself, so the `fn` key, media keys like volume and play, and the Touch ID button aren't blocked by Clean Keyboard. On macOS Tahoe and later, turn on **Lock Function Row Keys** to block the function row too.

### What can I use to clean my MacBook keyboard?

Apple recommends a soft, lint-free cloth, slightly damp with water if needed. You can also use a 70 percent isopropyl alcohol wipe on the keys. Don't spray liquid directly on the keyboard, and avoid bleach and abrasive cleaners.

### Can I lock the trackpad too?

Clean Keyboard has a **Lock Mouse Clicks** option that blocks clicks and dragging while you clean. It needs Touch ID, which you use to unlock. Scrolling and pointer movement still work.
