Pi HDMI Not Functioning
A common pitfall with the Raspberry Pi board is that the display connected to the HDMI port must be connected and powered before booting the Raspberry Pi. Otherwise, the HDMI output will not be activated. Take special care to ensure the HDMI connector is physically inserted all the way into the Pi, especially with the new micro-HDMI connectors on the Raspberry Pi Model 4B and newer.
If you have a Pi 4 or Pi400 and you have only one monitor, ENSURE you are using THE PORT CLOSEST TO THE MICRO-SD Card (HDMI0).
I'm using NOOBS or NOOBS Recovery and only see a rainbow:
If you are using NOOBS or NOOBS Recovery and are only seeing a rainbow on your display, please ensure you are using the HDMI0 connector (closest to the micro-SD card connector). At this time, NOOBS/Recovery only supports HDMI0 for starting. After, the OS selected will work with both displays (if supported by the OS).
My display stays black:
If your display is plugged in and powered before powering the Pi but stays black, you can try the following code to ensure that the HDMI output always activates (whether the monitor is detected or not) by adding the following lines of code to the config.txt file of the operating system on the micro-SD card, using any computer with a micro-SD card reader:
For Rasberry Pi models up to and including Pi3
hdmi_force_hotplug=1
hdmi_drive=2
For Raspberry Pi 4 models with dual HDMI
hdmi_force_hotplug:0=1
hdmi_force_hotplug:1=1
hdmi_drive=2
Note: Because the Raspberry Pi 4B and newer have two HDMI ports, some HDMI commands can be applied to either port. You can use the syntax <command>:<port>, where <port> is either 0 or 1, to specify which port the setting should apply to. If no port is specified, the default is 0. If you specify a port number on a command that doesn't require one, the port is ignored.
Note: On Pi 4s and Pi400s, there's an issue with displays using 1366x768 resolution (reference). The solution is to use another resolution, see here: STICKY: Setting up HDMI output when video output is wrong.
More details here: Raspberry Pi documentation - HDMI configuration and here: Raspberry Pi documentation - Video options in config.txt
Revised 2021-09-22 - Link update for the RPF website restructuring