Hit the Windows key and the L key on your keyboard. Keyboard shortcut for to lock.
Press Ctrl-Alt-Delete. On the menu that pops up, click Lock.
Tap or click the Start button in the bottom-left corner. Click your user icon and then select Lock.
If you’re using a Mac that’s running macOS Mojave, go to the Apple menu and choose Lock Screen or press Command+Control+Q. This will lock your Mac and return you to the Login screen.
For older versions of the operating system, press Control+Shift+Power button (or Control+Shift+Eject if your Mac has an optical drive). It will lock the screen.
You can also use a keyboard shortcut to put your Mac to sleep. Press Command+Option+Power (or Eject). This works in a similar way to the previous one, but rather than just lock your Mac it powers down the hard drive, puts the CPU into low power mode and stops background tasks in order to save energy.