With most of us keeping our important data on our Macs, it's not safe to keep our Macs unlocked and unattended. Luckily, there are various ways to lock your MacBook or iMac so that other people can't use it when you're away.

Here are some of the ways to lock your Mac.

Require a Password to Unlock Your Mac

When you first set up your Mac, you should have created a password for your user account. This password is what you will use when you want to unlock your Mac.

Here's how to ensure that your Mac prompts for a password when you have locked it:

Set a Password on a Mac
  1. Click the Apple logo in the top-left and select System Preferences.
  2. Select the Security & Privacy option.
  3. Make sure you are in the General tab.
  4. Tick the Require password box and then choose immediately from the dropdown menu next to it.

How to Lock Your MacBook

Now that you have set up a password, here are some of the ways to lock your Mac.

Close the Lid of Your MacBook

If you use a MacBook, the easiest way to lock it is to close the lid of your MacBook.

Simply pull down the lid and close it fully. When you open the lid, you ll find that your Mac asks for a password.

Use the Apple Menu

Another way to lock your Mac is to use one of the options in the Apple menu. Here's how:

Lock a Mac using the Apple menu
  1. Click the Apple logo at the top-left corner.
  2. Select Sleep.

Your Mac is now in sleep mode and is locked.

When you want to unlock your Mac, press a key on your keyboard and you'll be prompted to enter your password. Enter the password and your Mac will be unlocked.

Use a Keyboard Shortcut

There are keyboard shortcuts as well to help you lock your Mac. Depending on how you want to lock your Mac, you can use one of the few shortcuts to do your task.

One shortcut helps put your Mac into sleep mode. When macOS goes into this mode, it gets locked. To use this, press Control + Shift + Power buttons at the same time (this is mainly helpful on a MacBook). To unlock your Mac, press any key on your keyboard and enter your password.

The other shortcut is for just locking your Mac. This requires you to press Control + Command + Q buttons at the same time. Your Mac will immediately lock.

Related: The Most Useful Mac Keyboard Shortcuts to Know

Use Hot Corners

macOS offers a feature called Hot Corners that helps speed up your workflow. You can use this feature to lock your Mac as well. This way, you just need to bring your cursor into one of the horners and your Mac will get locked.

Here's how to configure Hot Corners for locking your Mac:

Lock a Mac using Hot Corners
  1. Click the Apple logo in the top-left corner and select System Preferences.
  2. Click Desktop & Screen Saver on the resulting screen.
  3. Access the Screen Saver tab.
  4. Select the Hot Corners button at the bottom of the panel.
  5. Choose the corner that you'd like to use to lock your Mac.
  6. Click the dropdown menu for your selected corner and select Put Display to Sleep.

From now on, whenever you bring your cursor to the corner specified above, your Mac will go into sleep mode and lock itself.

Use Fast User Switching

macOS comes with a feature called fast user switching. As the name suggests, this feature lets you quickly switch user accounts on your Mac.

Since it brings you to the login screen, it actually locks your Mac when you switch a user account.

Here's how to use this feature to lock your Mac:

Lock a Mac using fast user switching
  1. Open the System Preferences pane and click Users & Groups.
  2. Click the lock icon at the bottom and enter your password. This lets you change the settings on your screen.
  3. Click Login Options in the left sidebar.
  4. Tick Show fast user switching menu as on the right. You can choose any option from the dropdown menu for this item. We'll select Full Name.
  5. To lock your Mac, click your name in the menu bar at the top and select Login Window.

You should now be on your login screen and your Mac should be locked.

How to Automatically Lock Your Mac

If you don't want to manually lock your Mac, you can automate the process using a macOS option. Here's how:

Automatically lock a Mac
  1. Access the System Preferences and click Desktop & Screen Saver.
  2. Click the Screen Saver tab.
  3. Select an option from the Start after dropdown menu at the bottom. This is when your Mac will get locked.

How to Show a Custom Message on the Lock Screen

If you want people accessing your locked Mac to know something, you can add a message to your Mac's lock screen.

Add a message to the Mac lock screen
  1. Click Security & Privacy in the System Preferences window.
  2. Click the padlock at the bottom and input your password.
  3. Tick the Show a message when the screen is locked box.
  4. Select the Set Lock Message button to specify your message.
  5. Enter the message that you want to display on the lock screen, and click OK.

Related: How to Customize the Login Screen on Your Mac

Use a Third-Party App to Lock Your Mac

Besides the built-in locking feature, macOS actually has several apps to help you lock and unlock your Mac. Each of these apps comes with its own unique set of features.

Near Lock (free with an optional upgrade to a pro version) is one of these apps that lets you lock and unlock your Mac using an iPhone (you can unlock your Mac with an Apple Watch as well). This app uses the distance between your iPhone and your Mac to automatically unlock your computer.

If you use an iPhone and a Mac, this is a good app to have as you don't need to press anything on your Mac to unlock it.

Keeping Prying Eyes Away From Your Content by Locking Your Mac

If you leave your Mac unattended for any amount of time, you should lock it before you leave. This ensures all your personal as well as professional content is safe and secure from unauthorized users.

If you frequently travel with your computer or even work in different locations, keeping your data locked up tight is especially important.