If you don’t have an external monitor connected to your MacBook, closing it will put the entire laptop to sleep. It’s pretty easy. If you do have an external monitor, mouse, and keyboard connected, you can close your MacBook and use it in “Clamshell” mode. That is, you can use the computer with the external monitor and controls.
How to Connect Your MacBook to a Closed Monitor (Clamshell Mode) in 2021 – EASY
This default behavior should cover most use cases, which is probably why Apple doesn’t allow for much configuration. But maybe you want your MacBook to go to sleep when you close the lid, even with a display connected. Or maybe you want it to shut down completely? If that’s your situation, check out Clamshell, a free app that lets you choose.
The application sits in the menu bar and offers you five options. There’s the default behavior, which we described above, and then four more. Sleep puts your MacBook to sleep as soon as you close the lid, even if you have another display connected. This is great if you use an external display but never use your MacBook in clamshell mode. Great.
Shut Down takes things a step further by completely turning off your computer (requiring you to install a system-wide background helper). Shutting down your computer is great for conserving battery life, but it’s extreme in other ways: you risk losing all unsaved work and having to restart your laptop. If you’re using your MacBook in a public place, however, this is the safest option: it’s very difficult to access a Mac without the password if it’s completely shut down.