ThisCalculator

Everyday

Root Pixel 2, 2 XL, 3, and 3 XL with Magisk

Updated · Standard formula, shown below

Root Pixel 2, 2 XL, 3, and 3 XL with Magisk

Rooting a Pixel 2, Pixel 2 XL, Pixel 3, or Pixel 3 XL gives apps elevated system access and lets you use root-only tools or modify parts of Android. The usual method patches the phone’s own factory boot image with Magisk and flashes it with fastboot; it wipes the phone when you unlock the bootloader, so back up everything first.

What You’ll Need

  • A compatible Pixel 2, Pixel 2 XL, Pixel 3, or Pixel 3 XL, charged to at least 50 percent.
  • A computer with current Android SDK Platform-Tools (ADB and fastboot), a USB data cable, and working USB drivers if you use Windows.
  • The exact factory image for your phone model and current build, downloaded from Google’s factory image archive. Check the model and build number in Settings > About phone.
  • The Magisk app APK from its official project release page, plus a way to copy files between phone and computer.
  • Time to restore your data and reinstall apps. Bootloader unlocking performs a factory reset, and rooting can affect apps that check device integrity.

Step-by-Step

  1. Back up and check the device. Copy photos, downloads, authenticator recovery codes, and other important files off the phone. In Settings > About phone, note the model and build number. Do not proceed with a factory image for a different Pixel generation or model. Install any update you intend to use before starting, then download the matching factory image.
  2. Prepare the computer. Extract Platform-Tools to a known folder. Extract the factory image archive and locate its boot image, usually named boot.img inside the image archive. Some releases package files in more than one archive; extract the inner image archive too. Keep the original image unchanged. On Windows, install Google’s USB driver if fastboot does not recognize the phone.
  3. Enable developer options and debugging. On the phone, open Settings > About phone and tap Build number seven times. Enter your PIN if asked. Go to Settings > System > Advanced > Developer options (the exact grouping may differ by Android release), turn on USB debugging, and enable OEM unlocking if the option is available. If OEM unlocking is unavailable, the phone may be carrier-restricted or otherwise not eligible; do not try to bypass that restriction.
  4. Unlock the bootloader. Connect the phone and open a terminal or command prompt in the Platform-Tools folder. Run adb devices and approve the debugging prompt on the phone. Then run adb reboot bootloader, followed by fastboot devices. Confirm the device appears. Run fastboot flashing unlock and read the phone’s on-screen warning. Use the volume keys to select unlock and press Power to confirm. This erases user data. Set up Android again, then re-enable USB debugging and approve the computer.
  5. Patch the correct boot image. Install and open the Magisk app on the phone. Copy the matching factory image’s boot.img to the phone. In Magisk, tap Install, choose the option to select and patch a file, and select that boot image. Wait for completion; Magisk saves a patched image, commonly in the Downloads folder. Copy that patched file back to the computer and give it a clear name such as magisk_patched.img. Do not use a patched image from another device or build.
  6. Flash the patched image. Reboot to the bootloader with adb reboot bootloader. In the Platform-Tools folder, run fastboot devices again. Flash the patched image to the boot partition with fastboot flash boot magisk_patched.img, substituting the actual file name and path. Wait for fastboot to report success; do not disconnect the cable during the operation.
  7. Restart and verify. Run fastboot reboot. The first startup can take longer than usual. Open Magisk after Android loads and follow any in-app setup prompt, restarting if requested. Check that Magisk reports installation and that a root-checking app you trust can request and receive root access. Keep the original factory image and patched image for recovery.

Common Mistakes

  • Using a mismatched image: A boot image must match the phone model and installed build. A near match is not good enough and may prevent Android from starting.
  • Skipping the backup: Bootloader unlocking erases the phone. Copy data elsewhere before confirming the unlock prompt.
  • Flashing in the wrong mode: Use fastboot while the phone is on its bootloader screen, not while Android is running or in recovery.
  • Using an obsolete command or guide: For these devices, use fastboot flashing unlock and a current Platform-Tools release. Do not experiment with partition commands or files intended for other Pixel models.
  • Locking the bootloader again too soon: Never relock while a modified boot image or other system change is installed. Doing so can make the phone unbootable and may require a full restore.

Tips

Keep a copy of the exact factory image and note the build number before modifying the phone. After an Android update, the old patched image may no longer match; patch the boot image from the newly installed build before flashing. Read Magisk’s current instructions if its screens or options differ from these directions. Root access is powerful: grant it only to apps you trust, since approved apps can make broad changes to the device.

Troubleshooting

  • adb devices shows no device: Unlock the phone and accept the USB debugging prompt. Try a data-capable cable, another USB port, and the appropriate Windows driver. Change the phone’s USB connection mode if needed, then run adb devices again.
  • fastboot devices is blank: Confirm the phone displays its bootloader screen, reconnect the cable, and check the driver or USB port. Restart the terminal after installing Platform-Tools or drivers.
  • OEM unlocking is greyed out: Connect to the internet and restart the phone, then check again. If it remains unavailable, the device may have a carrier or management restriction; stop rather than attempting a workaround.
  • The phone boot-loops or will not start: Do not repeatedly flash random files. Return to the bootloader and use the exact factory image for the device and build to restore the stock boot image or reinstall the complete factory image. A full factory-image restore can erase data. Follow the archive’s included instructions carefully.
  • Magisk is installed but root is not granted: Open Magisk, check that installation completed, and review its Superuser section when an app requests access. If the app still cannot obtain root, confirm that the patched image came from the currently installed build and flash it again only after checking the file and command.

Frequently Asked Questions

Does rooting erase my Pixel?
Unlocking the bootloader triggers a factory reset. The later boot-image patching steps normally do not erase user data, but a recovery restore may, so maintain a backup.

Do I need to unlock the bootloader?
Yes. This method requires an unlockable bootloader. If OEM unlocking is unavailable or unlocking is blocked, do not attempt to bypass the restriction.

Will this work on Pixel 2 XL and Pixel 3 XL?
Yes, the general process is the same, but each model needs its own matching factory image and boot image. Never interchange images between the four models.

Will a factory reset remove root?
A factory reset alone does not necessarily restore the original boot image. To remove root reliably, restore the stock boot image or reinstall the correct factory image.

Will Android updates still work?
Updates may replace the modified boot image or fail while the system is modified. Before updating, follow current Magisk guidance and use the boot image matching the new build.

Can I relock the bootloader after rooting?
Do not relock it while the phone is rooted or modified. Restore the complete stock software first; relocking with modified partitions can prevent booting.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.