Normally, the best way to turn off a PlayStation 4 is via its controller. However, if your controller dies while the console is on, you're not out of luck.
You can turn off your PS4 without using a controller, which can be massively convenient if you don't have access to your controller.
You have two options: put it in a low-power "rest" mode, or you can shut the console down completely. It's a good idea to usually leave the PS4 in rest mode rather than shutting it off completely.
Check out the products mentioned in this article:
How to turn off a PS4 without a controller
To put your PS4 in rest mode, press and hold the power button on the front of the PS4 until you hear the system beep once — this should take just one or two seconds.
The power indicator will pulsate white, and then turn orange to indicate it's in rest mode.
On a standard PlayStation 4, the power button and indicator are near the center of the console.
On a PS4 Slim, there's a small power button on the left side of the console with the power indicator built into it.
On a PS4 Pro, you'll find the power button and indicator line near the bottom of the console.
To turn off the PS4 entirely, press and hold the power button on the front of the PS4 for about seven seconds. After it beeps the first time, continue holding the power button until you hear the system beep a second time. After the second beep, release the power button.
The power indicator will pulsate white, and then turn off completely.