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.
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.
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.
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.
fastboot devices, run the unlock command appropriate for your device.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.
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.
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.