Magisk Manager

Quick steps

  1. Back up your phone. Unlocking the bootloader erases everything on it.
  2. Turn on Developer options, then OEM unlocking and USB debugging.
  3. Connect the phone to a computer with ADB and fastboot and run adb reboot bootloader.
  4. Run fastboot flashing unlock, or your brand's method, and confirm on the phone.
  5. Restart, set the phone up again and install Magisk.

What is the bootloader?

The bootloader is the first program that runs when you turn your phone on. Before it starts Android, it checks that the software is signed by the phone's manufacturer. This is called verified boot. A locked bootloader only starts official software. An unlocked bootloader starts any software you flash.

Magisk works by patching your phone's boot image, so the image is no longer the one the manufacturer signed. A locked bootloader refuses to start it. That's why every Magisk install, custom kernel or custom ROM starts with unlocking.

What changes when you unlock

  • Your data is erased. The phone wipes itself to protect your files.
  • You'll see a warning at every start. Most phones show a message saying the bootloader is unlocked. It's normal and doesn't affect how the phone works.
  • Some apps may stop working. Many banking, payment and work apps use Google's Play Integrity API, which reports an unlocked bootloader. Some of them refuse to run, even without root.
  • Your warranty may be affected. Some manufacturers limit repairs on unlocked phones. On Samsung phones, unlocking permanently trips Knox.
  • Physical security is weaker. Someone holding your phone could flash modified software. Keep a screen lock on.

Can your phone be unlocked?

Most phones sold unlocked by the manufacturer can be. These usually can't:

  • Carrier phones, especially in the USA. Pixel phones sold by Verizon, for example, can never be unlocked.
  • Samsung phones sold in the USA and Canada.
  • Huawei and Honor phones from after 2018, when Huawei stopped giving out unlock codes.

The quickest test is the OEM unlocking switch in Developer options. If it's there and you can turn it on, your phone can be unlocked. If it's missing, or stays greyed out after the phone has been online for a while, it probably can't.

Step 1: Turn on OEM unlocking

  1. Turn on Developer options

    Open Settings → About phone and tap Build number seven times, then enter your PIN. On Xiaomi phones, tap the OS version instead. On Samsung phones, the build number is under Software information.

  2. Turn on OEM unlocking

    Go to Settings → System → Developer options (on some phones, Developer options is directly in Settings) and turn on OEM unlocking. Connect to the internet first: many phones check with the manufacturer before the switch can be turned on.

  3. Turn on USB debugging

    In the same menu, turn on USB debugging. When you connect the phone to your computer, allow it in the Allow USB debugging? prompt.

Step 2: Unlock with fastboot

This works on Google Pixel, OnePlus, Nothing and most other phones. Samsung, Xiaomi, Motorola and Sony need extra steps. You'll need ADB and fastboot on your computer: our ADB and fastboot guide shows how to set them up.

  1. Restart into the bootloader

    Connect the phone with a USB cable and run:

    adb reboot bootloader
    

    You can also turn the phone off and hold Power + Volume down until the bootloader screen appears.

  2. Check that the computer sees the phone

    fastboot devices
    

    A serial number should appear. If nothing shows up, see common ADB and fastboot errors.

  3. Send the unlock command

    fastboot flashing unlock
    

    Phones from before Android 6.0 use fastboot oem unlock instead.

  4. Confirm on the phone

    Use the volume buttons to select Unlock the bootloader and press Power to confirm. The phone erases everything and restarts.

  5. Set the phone up again

    Go through the setup, then turn on Developer options and USB debugging again. You'll need them to install Magisk.

Steps for each brand

Google Pixel

Pixel phones use the standard fastboot steps. The phone must be online before OEM unlocking can be turned on, and Pixels sold by Verizon can't be unlocked. After unlocking, the Magisk app can download your Pixel's factory image for you.

Samsung

Samsung phones don't use fastboot. You unlock the bootloader in download mode with the phone's buttons, and check KnoxGuard first. Follow our Samsung steps.

Xiaomi, Redmi and POCO

Xiaomi phones need Xiaomi's approval before they can be unlocked:

  1. Sign in to the phone with a Xiaomi account.
  2. In Developer options, open Mi Unlock status and add your account and device.
  3. On a Windows computer, use Xiaomi's official Mi Unlock tool. It usually makes you wait several days after you add the device, sometimes longer.

Xiaomi has changed these rules several times, especially on HyperOS, and phones sold in China have extra requirements. Check Xiaomi's current rules before you start.

Motorola

Motorola gives out unlock codes for eligible models. Carrier versions are often excluded.

  1. In the bootloader, run fastboot oem get_unlock_data and copy the code it prints.
  2. Paste it into the bootloader unlock page on Motorola's website, signed in with a Motorola account. Motorola emails you an unlock key.
  3. Run fastboot oem unlock followed by that key.

OnePlus

OnePlus phones use the standard fastboot steps. Some carrier versions need an unlock token from OnePlus first.

Sony Xperia

Get an unlock code for your phone's IMEI from Sony's developer website, then run fastboot oem unlock 0x followed by the code. Sony warns that unlocking can permanently delete some security (DRM) keys, which can affect a few features.

Other brands

Most other brands use the standard fastboot steps. If the phone refuses the command, check the manufacturer's support site: some brands require an unlock code, and some don't allow unlocking at all.

After unlocking: install Magisk

Your phone is ready. Go back to the main guide to install the Magisk app and find out which image to patch.

How to relock the bootloader

Only relock a phone that runs completely stock software. Relocking with Magisk or any other modified software installed can leave the phone unable to start.

  1. Uninstall Magisk and flash your phone's complete stock firmware.
  2. Restart into the bootloader and run fastboot flashing lock, then confirm on the phone.

Relocking erases your data again, so back up first.

Frequently asked questions

Does unlocking the bootloader root my phone?

No. Unlocking only lets your phone start software that the manufacturer didn't sign. Root comes from installing Magisk afterwards: see how to install Magisk.

Does unlocking the bootloader erase my data?

Yes, on almost every phone. Android wipes the phone during the unlock so that whoever unlocks it can't read your files. Back up everything first.

Is unlocking the bootloader legal?

In most countries it's legal to unlock the bootloader of a phone you own, using the manufacturer's own method. It can affect your warranty, so check your manufacturer's terms.

Will I still get system updates after unlocking?

On most phones, yes, as long as the software is unmodified. Once Magisk is installed, an update removes root until you install Magisk again: see how to update Magisk. Rooted Samsung phones can't install updates over the air.

Why is OEM unlocking greyed out?

Connect the phone to the internet and check again: many phones confirm with the manufacturer first, and some Samsung phones need a few days. If it stays greyed out, the phone is usually carrier-locked or locked remotely, and its bootloader can't be unlocked.

Can I unlock the bootloader without a computer?

Only on Samsung phones, which unlock from download mode using the phone's buttons. Every other brand needs fastboot on a computer, and you'll need a computer later anyway to flash the patched image.