Fastboot is a powerful tool bundled with Google Android SDK and also an engineering protocol that helps to write data directly to your phone’s flash memory. Since it directly writes to the phone’s flash memory, It can start on your device even before Android OS loads, even under the scenario when Android isn’t installed at all.

The phone needs to be booted into “Bootloader mode” to use the Fastboot commands. It enables access on all your device partitions. Hence, one can patch those partitions by flashing firmware, recoveries, bootloader etc.

Fastboot is most commonly used for unlocking the bootloader or to establish communication with hardware when the software has failed or bricked. If you are familiar with rooting and modding your android phone, you must have heard a lot about ADB and fastboot. If you are new to this scene, we’d recommend checking our beginners guide to rooting.

Popular Fastboot Commands

When you’re working on the bootloader mode, ADB commands will no longer work, as the device is not booted into Android OS. Hence, the Android debugging tools can’t communicate to the phone. As mentioned above, the Fastboot commands would work even if the OS isn’t booted, provided your device is booted into Bootloader/Fastboot mode. These are probably the most useful tools available which will come to rescue when you brick your device or when you want to replace your device partitions.

To execute the below mentioned commands, you’ll also need to have Fastboot installed on your computer system, You can follow our guide to install ADB and Fastboot for the installation. Now that you have Fastboot working on your system, you can check the below commands. To make it easier, we’ve added a short description, syntax and an example.

Before you begin executing the commands:

Fastboot devices command

Type Fastboot devices in the command prompt and result should be a serial number, similar to the adb devices command. If entering this command shows your device name with a serial number, it implies that your phone is good to go for fastboot operations. However, if the result is empty then you might want to check the fastboot installation and drivers.

Syntax:

fastboot devices

Fastboot OEM unlock command

The Fastboot OEM unlock command is the most popular command, it is your key to unlock the bootloader of your device. Although this command works with most of the devices, it won’t work for some brands. If your OEM enables fastboot mode, then you will be able to unlock your phone with this command.

Brands such as Google Pixel, Google Nexus, OnePlus, HTC, Motorola, and etc. usually support bootloader unlock with this command. If you own a different device, you’d have to follow separate guides to do the trick. Also, unlocking the bootloader voids the warranty for some brands, so only unlock if you are willing to risk your warranty.

Syntax:

fastboot oem unlock

PS: Running the unlock command in the command prompt will wipe your entire data on the phone. So please proceed carefully. We won’t be held responsible for your data loss!

Fastboot OEM lock command

The Fastboot OEM unlock command is opposite of the OEM unlock command. Using this command, you can lock your bootloader and go back to the stock factory mode.

Just for information: This command could help you with your warranty even after you’ve unlocked it. Because in most parts of the world, the representatives at service centers think that a locked bootloader means the device wasn’t unlocked. Although there are ways to find out if a device was previously unlocked, most of the service centers don’t get that far. But if they find out, don’t blame us!

Syntax:

fastboot oem lock

Fastboot Flash command

The Fastboot flash command would help you to flash ZIP files. Companies like OnePlus, release the flashable ZIP file of the upcoming firmware for their testers. So, one can simply download the ZIP file, place it in the folder on their PC, open Command window from that folder and flash the zip. Normally, fastboot images are flashed in this way.

Note: It is always recommended to place the zip files in the same folder of your ADB binaries so that you do not need to specify the path or you can alternatively open the command window from that particular folder.

Syntax:

fastboot flash %FILENAME.ZIP%

Example:

fastboot flash newfirmware.zip

Fastboot Flash Recovery command

The Fastboot flash recovery is a powerful fastboot command which is used to flash recovery images. This will patch your recovery partition with a new image. When we install a custom recovery such as TWRP on our device, this is the command we use. This would replace the stock recovery with the custom recovery.

Syntax:

fastboot flash recovery %FILENAME.IMG%

Example:

fastboot flash recovery twrp.img

Fastboot Flash Boot command

The boot image contains the kernel of your device. You can use the Fastboot Flash boot command to replace the stock kernel with a custom kernel of your choice. This command would replace the boot partition of your device. It might look simple, but could be risky if you flash a wrong boot image. There are chances that your device might not boot or might get stuck in a Bootloop. The only way to recover if you mess up with this would be flashing the stock boot image.

Syntax:

fastboot flash boot %FILENAME.IMG%

Example:

fastboot flash boot bootimage.img

Fastboot Erase command

As the name says, this command would erase items from your device. By using the Fastboot erase command you’ll be able to wipe data from different partitions on your device. This command is generally used before flashing a new ROM, as it wipes the existing data and makes space for the new files to be written. This command deletes all your data from the partitions you’ve mentioned in the command, so it’s always a good idea to take a backup before you run it.

Syntax:

fastboot erase %PARTITION NAME%

Example:

#To erase system partition
fastboot erase system

#To erase boot partition
fastboot erase boot

#To erase cache partition
fastboot erase cache

#To erase user data partition
fastboot erase userdata

#To erase recovery partition
fastboot erase recovery

Fastboot Format command

If you want to completely format the flash partitions of your device, you can use Fastboot format command. This will allocate new blocks of data to your device partition and that makes it different from fastboot erase command. A full backup of device data is always recommended as it can wipe your entire data.

Syntax:

fastboot format %PARTITION NAME%

Example:

#To format system partition
fastboot format system

#To format boot partition
fastboot format boot

#To format cache partition
fastboot format cache

#To format user data partition
fastboot format userdata

#To format recovery partition
fastboot format recovery

Fastboot Reboot/reboot-bootloader commands

The Fastboot reboot command will help you to boot your device normally to OS. On entering the reboot command you’ll be booting the system partition of your device. Whereas the reboot-bootloader command will take you back to bootloader mode followed by a reboot.

Syntax:

#To reboot your device
fastboot reboot

#To reboot your device to fastboot mode
fastboot reboot-bootloader

Conclusion

Because of its powerful nature, OEMs do not enable fastboot mode for all phones. Although It’s enabled for most of the smartphones (Almost all). Some popular manufacturers which enable the fastboot mode for their devices are Google Pixel, Nexus, OnePlus, Motorola, HTC, Xiaomi, ASUS, Sony, Huawei, etc. The Android community developers also help you with ways to unlock it if there’s no official method available (for some devices.) With little knowledge about the commands and right hardware, Fastboot could be a great utility and knowing its commands could be helpful!

  • how to used command format boot ??????????????????
    …………………………………………………………..
    C:\Users\Piro\Downloads\HTC One M9>htc_fastboot devices
    FA55LYJ00130 fastboot
    htc_fastboot finished. total time: 0.500s

    C:\Users\Piro\Downloads\HTC One M9>htc_fastboot flash recovery twrp-2.8.7.0-hima
    .img
    htc_fastboot v3.0.7 (2015-03-30)
    target reported max download size of 536870912 bytes
    sending ‘recovery’ (36288 KB)…
    OKAY [ 1.469s]
    writing ‘recovery’…
    FAILED (remote: cannot flash this partition in s-on state)

    C:\Users\Piro\Downloads\HTC One M9>htc_fastboot format boot
    usage: htc_fastboot [-h] [-v] [-V] [-d] [-s ] …
    htc_fastboot: error: argument : invalid choice: ‘format’ (choose from ‘
    flash’, ‘erase’, ‘getvar’, ‘devices’, ‘reboot’, ‘reboot-bootloader’, ‘dump’, ‘oe
    m’)
    ………………………………………
    how to solved ” [-h] [-v] [-V] [-d] [-s ] … “

  • This is very informative! I appreciate this post, Subham! Your site is the only site which is ad-free and focused on information. I love the way your writing style! Respect earned mate!

    • Thanks a lot Neil,

      I really appreciate your response. We don’t plan to show ads anytime soon and even if we do, we won’t forget about our “content-focused” approach.

      Since you’ve commented here, You seem to be interested in Fastboot, Do check our beginner’s guide on Fastboot here: https://android.tutorials.how/fastboot/

  • Hi, Subham. Excuse me for my bad English.

    However, thanks for your help with adb and fastboot.

    My mobile brick after an update a new stock ROM. Searched various sites, forums and only with your tutorial I solved my problem.

    My mobile is ASUS ZenFone 4 pro selfie, model Asus_z01md (ZDK552KL). But you forget the command fastboot flash system. I get download archive zip file from ASUS, last version firmware. After I extract all archives in the Desktop folder.

    Convert all archives and folders of the package, except boot.img to system.img and enter commands: fastboot flash boot boot.img, fastboot flash system system.img. Before I used commands erase in the description of the tutorial. Finally, I used commands fastboot reboot. Now all is working. Thank you very much.

    • Hey Wandé Mota,

      Thanks for getting back, I’m glad that our tutorial helped you solve the problem.

      I’m really sorry for missing out the fastboot flash system command, but don’t worry, the newer version of this article is under creation and we’ll try to include all the commands which have been missed.

      And Bad English is fine, never be sorry about that, but maybe learn the language in a better way. That’s the best you can do!

      • Exactly, it is always good to try to learn what is not known, as in the case, the language. What is important is that we should seek to broaden our knowledge. Sorry, I did not introduce myself.

        I live in Brazil, I’m a civil servant and I have higher education in computer networks. You have my e-mail if you want to exchange ideas, just send. I still have a little problem with my cell phone.

        When I unlocked the bootloader and installed the ROM, the boot was left with a corrupted device message.

        I searched the internet and saw that other people had the same problem, but I did not find an answer, and the lock or relock commands did not work.

  • Thanks a lot…
    It’s so much easier than I tried…
    I’m still learning…

    Anyway… Thanks again.

    • You’re welcome, Jimbo!

      Do get in touch with us if you have any other topics in mind, we’ll consider writing about them!

  • Hi Subham

    I am just abeinner, Actually started exploring once my phone got stuck in bootloop. I read your articles and found them very simple to understand and covered in detail., your work is really appreciated. I would like to request your support on the issue of boot lop, which has not yet been resolved. I am using Karbonn Sparkle V with android 6.0.1/MoB31E which just stuck at bootloop (with no known reasons). – (Stock Recovery).
    – Debugging enabled but not connecting to PC, so no ADB, SP Flash tool not detetcting device. (PC not identifying, tried almost all drivers).
    – Tried Factory reset, Cache wipe, etc. Did not work.
    – Tried to flash Stock Roms like marshmallow MMB290, lollipop and even Kit kat 4.4 (from SD Card) all gave errors.(earlier versions)

    – Have option to update from SD Card, and
    – Fast boot also accessible.

    Please advise on this, how to get rid of this bootloop from flashing through SD card OR fast boot mode
    (Even willing to root my phone, if required, but dont know the procedure to root through fast boot or is there any other possible way? to root 6.0.1/MoB31E)

    Thanks and regards.

    • Hey Syed,

      Really sorry for the late response, I’ve been working on so many projects that I didn’t get much time. Thanks for liking my work.

      When your device is stuck in bootloop, the only option I’d opt for is: Booting into fastboot mode and flashing the stock firmware. If that’s not possible, I’d consider unlocking the bootloader, flashing a custom recovery, and flash a custom ROM from the recovery.

  • I have a plan to reflash all partitions on my Nexus 5. Should I run fastboot erase before flashing each partition?

  • Hello mex..!!!
    My phone Lenovo k350t.
    Im flash not working men..
    Please, help me..
    Thank..

    • Which command didn’t work for you?

      If it’s just the unlock bootloader command which didn’t work, then there’s a good chance that Lenovo doesn’t allow you to unlock the bootloader of the device. Did you try testing the fastboot devices command after connecting your device? In that case, you might have not installed fastboot properly, troubleshoot the installation and let me know if it still doesn’t work.

  • Hello Subham,

    I own a google pixel 1 model with sailfish variant. I updated my phone to Android Q beta, which worked fine. Later the devices started restating automatically. I then submitted my phone to services centre & they denied that ‘it cant be resolved by software, it has some mother board issue, we suggest you to change the mother board’. Its prices cost me 70% of the prices at which i purchased my phone. I then tried many ways to flash my phone manually. Some how I succeeded with unlocking bootloader. But i am still unable to push OS in my phone as the usb debugging is disabled. Help me with some solutions.