Fastboot

How to Unlock Your Android Bootloader via Fastboot

Published: June 26, 2026 Applies to: Most Android devices — Pixel, OnePlus, Xiaomi, HTC, Motorola, Sony; not Samsung

Unlocking the bootloader is the prerequisite for installing custom recoveries, flashing custom ROMs, and gaining root access on Android. The process uses the Fastboot command-line tool and takes under five minutes on supported devices. This guide explains the mechanics of bootloader locking, the two unlock commands in use across different manufacturers, what data wipe happens and why, and how to verify your unlock status afterward.

What Bootloader Locking Does

The Android bootloader enforces Verified Boot: it checks a cryptographic signature on the boot image before handing off execution to the OS kernel. If the signature does not match the manufacturer's signing key, a locked bootloader refuses to boot the image — preventing unsigned or modified kernels from running. This protects end users from certain classes of supply-chain attacks and persistent malware, but it also prevents installing custom software.

Unlocking the bootloader disables this verification step. The device will boot any image passed to it via Fastboot, including unsigned custom recoveries and third-party ROMs. The tradeoff is that Android's Verified Boot indicator in the OS will show the device as modified, which some banking and enterprise apps detect through the SafetyNet or Play Integrity API.

Prerequisites Before You Unlock

Booting into Fastboot Mode

Power off the device completely. Then hold the hardware button combination for your device to enter Fastboot mode. Common combinations:

Alternatively, if ADB is already connected with USB Debugging enabled, reboot directly into Fastboot from a terminal:

adb reboot bootloader

The screen will display a Fastboot or Bootloader menu. Connect the USB cable if not already connected. Confirm the PC detects the device:

fastboot devices

The output shows your device's serial number followed by fastboot. If nothing appears, the USB driver for Fastboot mode may not be installed — refer to the USB driver guide for your manufacturer.

The Two Unlock Commands

There are two distinct Fastboot unlock commands used across the Android ecosystem. Which one works on your device depends on the manufacturer and Android version:

Command 1: fastboot flashing unlock

fastboot flashing unlock

This is the standard command introduced with Android 6.0 and adopted by Google Pixel, OnePlus, Motorola, Sony, and most modern devices. It is the correct command for any device released after 2016.

Command 2: fastboot oem unlock

fastboot oem unlock

This is the legacy command used on older devices (pre-Android 6.0), older HTC models, and some Nexus devices. On modern devices this command either does nothing or returns an error. Try fastboot flashing unlock first; fall back to fastboot oem unlock only if the first command is unsupported.

Some manufacturers (Xiaomi, Vivo, Realme) require an additional unlock token or a waiting period enforced by an online account system before either command is accepted. The Fastboot command itself is the same, but the device will reject it until the account-side authorization is granted.

The Unlock Process Step by Step

  1. With the device in Fastboot mode and detected by fastboot devices, run the unlock command appropriate for your device.
  2. On the device screen, a warning message appears explaining that unlocking will erase all data and disable Verified Boot. Use the Volume keys to navigate to Unlock the bootloader and press the Power button to confirm.
  3. The device performs a factory reset. This takes 30 seconds to 2 minutes depending on storage size.
  4. The device reboots. On the first boot after unlock, a message such as "Your device software cannot be checked for corruption" or an orange padlock icon appears briefly before Android boots. This is normal and permanent.
  5. Complete Android setup as a new device. Your data is gone and cannot be recovered from the device itself.

Verifying Unlock Status

To confirm the bootloader is unlocked, boot back into Fastboot mode and run:

fastboot getvar unlocked

The output should read:

unlocked: yes

On some devices the variable is named differently:

fastboot getvar all

This dumps all Fastboot variables. Look for unlocked: yes, lock_state: unlocked, or bootloader-unlocked: yes depending on the manufacturer's variable naming.

You can also verify unlock status from within Android (after booting) under Settings > Developer Options. A locked bootloader shows OEM Unlocking as off; an unlocked bootloader may show an additional status field or simply allow the toggle to remain in its enabled state.

Re-locking the Bootloader

If you want to restore a device to a stock, locked state (for resale or warranty return), re-lock with:

fastboot flashing lock

Or the legacy equivalent:

fastboot oem lock

Re-locking also triggers a factory reset. Additionally, for Verified Boot to pass after re-locking, the boot image must be a genuine, unmodified manufacturer image signed with the correct key. If a custom ROM is installed when you re-lock, the device will fail Verified Boot on every subsequent boot and either show a warning screen or refuse to boot entirely. Always flash official stock firmware before re-locking.

A Note on Samsung Devices

Samsung Galaxy devices use a completely different mechanism called Odin and do not support standard Fastboot unlocking. Samsung devices have a Download Mode (Volume Down + Bixby + Power on older models; Volume Down + Power on newer) for flashing via Odin on Windows. The fastboot flashing unlock command does not function on Samsung hardware. Additionally, Samsung's e-fuse system permanently trips a counter (visible as "KNOX 0x1") when unofficial firmware is flashed, which voids Samsung Pay and certain Knox enterprise features permanently even if stock firmware is restored.