How To Restore Nexus 5 to Stock Factory Images


Here’s a guide how you can restore Nexus 5 to stock factory images to revert to the original stock firmware from custom ROM rooted versions. Android is world’s most used mobile firmware because it offers a wide array of device and software customization feature. Even a non-expert can tweak Android OS to use it the way they want. Android has the biggest library of mobile apps, you can find any app or game on Android including many Android exclusive apps and games. Android also allows users to root the firmware to unpack unlimited potential of the firmware and mobile device. You can easily install Custom ROMs, Custom Kernels, Modded apps and hacks and more on Android.

Rooting Android device helps you to install third-party apps, recoveries and ROMs that can greatly improve battery life, layout and app customization features, enhance processor power (though not recommended) and lots more. Rooted Android devices are perfect for those who want to unleash full device power for Android app development purposes using custom ROM, kernels, firmware, mods and more. However, sometimes things may not pan out the way you intended, rooting could cause issues with the device stability if not properly enabled; it also void device’s warranty, which means replacing it via official vendors is no longer an option. In such cases, you would be better off to revert the firmware of your rooted Android device back to the official/original stock firmware.

If your phone is experiencing bootloop problems, or simply wish to restore the stock firmware on Nexus 5, then keep on reading as we are going to show you how to flash factory image on Android powered mobile or tablet. Interestingly enough a personal experience has prompted me to write this article. The other day i was trying to flash Android 7.0 Nougat Gapps and a custom ROM file on my phone, but as i created a backup of the old ROM and proceeded to clearing device data and cache, all hell broke loose. Suddenly my device device went into bootloop, which prompted me to restore factory/stock image on the Android device.

Thankfully, Google regularly rolls out stock Android OEMs for its devices, not many Android powered device manufacturers with exception of Motorola release stock firmware OEMs for public download and use. Nexus 5 owners can use the official stock factory image to restore their devices to stock firmware. It only takes a few minutes to flash stock image on Nexus 5. You can use instructions in this guide to restore stock firmware on any Nexus device, but make sure you follow the process with the image file for your device model.

Before You Start:

1 – Enable USB Debugging on your Nexus 5. Go to Settings > Developer Options > USB Debugging.

2 – Download Google USB Drivers on PC Windows and install them, if you haven’t already done that. The USB Drivers are in zip format, here’s what you need to do to install them. Download and extract the Google USB drivers. Connect your phone to PC. Press Windows + X keys on the keyboard and select ‘Device Manager’ option. Next, click on the ‘Other Devices’ button. Here you should see a yellow colored triangle with Nexus 5, now select ‘Update Driver Software’ option on the list and click on the ‘Browser My Computer for Driver Software’ option. Locate the ‘latest_usb_driver_windows’ folder and click ‘Install’. Once installed, your device should show in Device Manager window under ‘Android composite ADB Interface’.

3 – Download and install Android SDK on your PC. Download the SDK zip file and extract it to C:/Program Files/Android (create the Android folder if you don’t see it). Windows 8 users need to extract the SDK file to ‘Program Files (x86)’ folder. Now, run the SDK Manager.exe setup file as administrator. Make sure Google USB Drivers from the above step are properly installed on your computer. To know more, see ADB and Fastboot on Windows & MAC.

4 – Download Nexus 5 Stock Factory Image file.


The process as described in the guide below is highly custom. Although the procedure is quite simple but it does involve some ADB and Fastboot commands, so follow it carefully as we will not be responsible for any kind of damage to your device.

Steps To Restore Nexus 5 To Stock Factory Image

Make sure you have made all necessary preparations and downloaded required files as mentioned above before proceeding. Also, make sure stock factory image file for Nexus 5 is the correct one, download it from the link provided above. After that, follow these steps:

1 – Extract the downloaded Factory image file for Nexus 5 with .tgz extension. On some browser the stock factory image file is downloaded and saved as a .tar file, change .tar extension to .tgz in order to successfully extract the file.

2 – Now open the factory image folder that you just extracted and locate a zip file inside it and extract it as well.

3 – From the factory image folder, copy all image directory content and the zip file to C:/Program Files/Android/sdk/Platform-tools on PC. In the image below you can see all image files that you need to copy to flash the stock firmware using Fastboot commands.


4 – Next, turn OFF your device. Press and hold the Volume Down + Power keys together for a few seconds to reboot the device into the Bootloader/Fastboot mode.


5 – Now connect Nexus 5 to computer via USB cable.

6 – Open the platform-tools folder where you copied and saved the factory image files. Next, press the Shift + Right + Click on the mouse at an empty space with the platform-tools folder to open a command window.

7 – Now to start the stock firmware flashing process on Nexus 5 you need to type in some commands. Type one command at a time, wait for it to process before typing the next one. (MAC users should not forget to add ./ at the start of every command, for example, ./fastboot reboot-bootloader). Some files names may be different for different PC and Nexus 5 model number, so we have shown those file names in places in bold letters to show where you need to enter the file names for your device. Type following commands one by one:

fastboot flash bootloader bootloader-hammerhead-hhz11k.img 

Note: (file name in bold letters above may be the same or different for your device, confirm it in the platform-tools folder before entering)

fastboot reboot-bootloader

fastboot flash radio radio-hammerhead-m8974a-

fastboot reboot-bootloader

fastboot flash system system.img

fastboot reboot-bootloader

fastboot flash userdata userdata.img

fastboot flash recovery recovery.img

fastboot flash boot boot.img

fastboot erase cache

fastboot flash cache cache.img

8 – Now your Nexus 5 is back to the factory image just like the new stock Android nexus 5 device and has original firmware version that came installed on your device. However, there is one little thing that you need to take care of and that is to lock the bootlaoder. If you unlocked bootloader on your Nexus device, you need to lock it again by entering the following command in a command window:

fastboot oem lock

9 – You can keep the bootloader unlocked on Nexus 5 by skipping the previous step and just pressing the Power button on your mobile device on the START screen.

In the end, i would be remiss if i fail to mention that most factory images for Nexus devices have flash scripts enabled, which makes it easier to flash required files from a single click. But i suggest that you use the fastboot command method as it is less risky. However,  if you decide to flash scripts, you can do so by typing following command in a command prompt window:

flash-all.bat (on Windows)

./ (on MAC)

That’s all. If you have any question, don’t hesitate to contact us in the comments section below.

Copy Protected by Chetan's WP-Copyprotect.