Turn off the macbook main display while working with monitor MBP 2015 13, 10.12.2

I want to use an external display via HDMI and turn off my Macbook Pro's display. How can I do it?

Update

There is another question: How do I turn off laptop display when I have an external display?, but I don't think this one should be marked as duplicate. 

Its 2017 now and the old question has answers from 2011-2014.

The other thing is - that the old question has also links to other answers and solutions. With this question we have answer with 2 variations of how to do it in one place.
Using an external keyboard and mouse/trackpad
You can use Closed Clamshell Mode. This is a feature built in to Macbooks that allows you to use them like desktop computers, with the lid closed and using a monitor as your only screen.
You'll need:

An AC power adapter (like this one)
An external keyboard and mouse or trackpad, either USB or wireless (like this keyboard and this trackpad)
An external display or projector (like this one)
(Optional) A dock for your MBP (like this one)

To put your MBP into Closed Clamshell Mode:

Connect your keyboard and mouse/trackpad to the computer
Plug the computer into power
Connect it via HDMI or Thunderbolt to the external monitor
Close the lid
OR place a weak magnet next to your trackpad (the sensor for closed lid detection is there &amp; magnetic) for better cooling (I use an old iPad case)

Once in Closed Clamshell Mode, the Macbook's screen will turn off and it will still be outputting picture to the monitor. Read more on Apple's support page.

[![enter image description here][1]][1]
Using the built-in keyboard and trackpad
You can dim your Macbook's screen all the way down (just press brightness down repeatedly) and then connect the Macbook to your monitor with HDMI. Your screen will be off but the keyboard and trackpad built into the Macbook will still be on and available. Optionally, you can download the free app Amphetamine to keep your Mac from sleeping.