How to easily root your Pixel 4 with Magisk
1) Unlock the bootloader
First you need to unlock the bootloader. This will allow you to install unofficial firmware like Magisk. Installing the bootloader automatically deletes all data.
2) Install TWRP
Once the bootloader is unlocked, you need to use TWRP to install custom mods. TWRP is the easiest way to install mods, especially Magisk for root. If you don't already have TWRP for Android 10 on your Pixel 4 or 4 XL, install it.
3) Download Magisk
Now you need to take the Magisk ZIP installation file, with which you can root. It includes the Magisk Manager application for managing modules. Download the latest version of Magisk and save it to your Downloads folder on your smartphone.
https://github.com/topjohnwu/Magisk/releases
4) Boot into TWRP
There are several ways to boot your device into recovery mode. The easiest is to use the bootloader menu, also known as Fastboot Mode. There are separate articles to describe this process.
5) From the main bootloader screen, you need to open the menu using the volume buttons. When you have selected the "Recovery Mode" option, press the Power button to confirm your selection and the TWRP main menu will open. TWRP for Pixel 4 is still in the testing process, so you need to download it from your computer every time.
6) Installing Magisk
From the TWRP main menu, click Install, then open the Downloads folder where the Magisk installation file is located. Click on it and slide your finger across the slider to start installation.
The procedure for making changes to the boot image for root access will begin. When finished, click the "Restart" button.
7) Confirmation of root access
In the Magisk Manager app, click on the arrow next to Click to Run SafetyNet Test. You should see the message "SafetyNet check successful", but it is not correct. As stated above, the SafetyNet test fails on most devices with an unlocked bootloader. You can use your mods, but SafetyNet apps may not work. These include financial programs, Pokémon GO, Google Pay.
8) This means Magisk is working fine and has been updated to the latest version. At this point, you have full root access, but there may be problems with SafetyNet checks.