Share this Story

How to: Flash Nexus Factory Images

Part of the beauty of owning a Nexus device comes through the regular availability of factory images that can be used to return the device to a factory state. If you root, toss on a ROM, and tinker a bit too much, you may find yourself looking for a last resort to save your phone. A factory image can do that. Or maybe you need to wipe your phone clean because you are done with it and need to pass it along to a friend or family member (or in a back alley deal on Craigslist). Again, a factory image can do that. Think of a factory image as stock, out-of-the-box software for your device.

Google has been pretty good over the years at making these image files available shortly after they release a new update or version of Android. That situation hasn’t changed with the release of Kit Kat (Android 4.4) or the Nexus 5, as Google has already made the N5’s factory images available. 

So for those of you who plan to get dirty with your Nexus and may need a savior down the road, we thought we’d make sure you know how to flash .img files to your Nexus 5. The process isn’t difficult, but does require a few adb and fastboot commands. But you are up for that, right?

NOTE:  These instructions are specifically for the Nexus 5, but they will work for any Nexus device (and Pixel devices). All you need to do is make sure you have downloaded the correct factory image file that you want to flash for your particular Nexus device and follow the instructions, replacing file names with the files names in the factory image you downloaded.


*In order to flash factory images, you’ll need to have the Android SDK set up. Download the latest SDK here.

*Flashing factory images wipes your phone completely clean, leaving it at a factory, out-of-the-box state.

*You’ll also need an unlocked bootloader.

1.  Download the newest factory images to your PC.

Download Link

2.  Unzip the file and its contents into your SDK/platform-tools folder.

*Make sure they are not in their own folder, but have all been extracted to platform-tools.

*We care about platform-tools, because that’s where your adb and fastboot are located.

3.  From within your platform-tools folder, open a command prompt.
4.  Type the following commands, allowing each to finish before moving onto the next:

*These instructions are for the 4.4 (KRT16M) files. If you stumble upon this later, be sure to adjust the filenames depending on the factory images you download.

*If using a Mac, be sure to add ./ in front of all commands (ex: ./fastboot reboot-bootloader)

*If you are updating a WiFi-only tablet, there is no radio.img to flash.

*If you don’t want to wipe data, remove the “-w” in the second to last command.

adb reboot bootloader
fastboot flash bootloader bootloader-hammerhead-HHZ11d.img
fastboot reboot-bootloader
fastboot flash radio radio-hammerhead-M8974A-
fastboot reboot-bootloader
fastboot -w update image-hammerhead-krt16m.zip
fastboot reboot-bootloader

5.  If you want to go back to 100% stock with a locked bootloader type:

fastboot oem lock

6.  If you want to keep your bootloader unlocked, simply tap the Power button from the START screen.
7.  You are now back to 100% stock.

Note:  At the point where you enter fastboot commands to flash individual files, you can think about running included scripts that will flash everything for you. All factory image files should have a flash all file. This will save you from having to manually enter in each line. I’ve had terrible luck with the included flash all scripts, but you may have success.

Once you reboot to the bootloader, you can try typing “flash-all.bat” if you are on Windows or “./flash-all.sh” if on a Mac into your command prompt. If you go this route, you’ll be able to sit back and watch each .img file being flashed. Just remember, you do not want to unplug your phone at any time.

And there you have it, flashing factory images.

  • Hothfox

    Tip: right click on the flash-all.bat file and “Run as administrator”. Maybe it was obvious for everyone else, but I thought I had to use “fastboot flash flash-all.bat”, and I got an error trying to do so.

  • datta

    perfect..I have flashed successfully..Let me check the expereince..But thanks to this author

  • Gerhart Steiner

    Will the Bootloader and Radio also be changed on an OTA-Update, or have i to flash the Factory-Image to get newest Bootloader and Radio

  • Jon

    when I try to update the image on the nexus 4, fastboot crashes. Any ideas why?

  • amulya

    Is there a really easy way to do this or is this it. Cause I’m a noob when it comes to this. The most tinkering i’ve ever done with a phone is when i installed Cyanogen mod on my old G1 I rooted.

  • Force286

    tried flashing my nexus 4 manually didn’t work,but the batch worked. thanks for the files!

  • Claus Krüger Lauritsen

    Is it possible to flash the 4.4 factory image to Galaxy Nexus??

    • Menger40

      Factory images are phone-specific.

  • The details are well-explained and very concise.

  • With two Samsung phones neither really peforms well and for my investment in their technology, it would have been wiser to wait for the Nexus 5.


    Is this different than pressing Factory Reset on the phone?

    • shadyguy

      They both wipe the device, but .img flashing can have different uses too

  • Pakmann2k

    While I am sure this is appreciated to some, it seems over the past few years, Romming, Rooting, and flashing have become the “niche” crowd to the DL followers. When I started following a few years back, I found this website out of luck because I wanted to unlock and flash my original Droid. Has been a favorite page since then. When the Nexus came out on Verizon, that is when I realized the crowd I joined with had pretty much left. I figured this out with the thousands of posts from followers that were upset they weren’t getting timely updates from Verizon to their Nexus. I couldn’t figure it out, “why wait for a carrier update when you have a Nexus?” It is because too many people just bought the Nexus name without realizing what to do with it. They bought a phone capable of being unlocked and customized but they chose to sit and leave it stock and then whine about their experience. They all claim they wanted the “stock” experience but when Verizon let them down, they didn’t lift a finger to do anything about it.

    • eazy

      still some OG droid life followers around! it is kinda sad that I have to go to other sites to see the latest roms, but hey things change. I do kinda wish droid life would go back to its roots.

      • Pakmann2k

        I think there are a lot of us still here, but we are out of the game and on the sidelines. DL has somewhat left the arena of being a customization and hardcore user blog. It is more of a review site and an android following site. They used to have a sister site. Android-life that was “all things android” and the droid-life site was committed to the droid but they dropped it. Then they sold us all on the “Droid-life” is about all androids. That wasn’t the case when it began. Now, a droid is like an afterthought device. It reminds me of a great quote, from a great movie, SLC punk. ” I didn’t sell out son, I bought in.” To each his own. I still follow, and I still comment, but DL is basically become a grassroots level CNET. A few years back, I had a Google TV review punlished on here. Nowadays, I am lucky to get a response from an email. Not laying hate, just saying this place has lost its way and what used to be special and unique has now become generic and “just like every other android site.”

        • Milind Shah

          i have been visiting droid-life for months now, and i would understand what you said, but at the same time if it ever had to grow, it would have to come out of the shell and not only cater to the niche crowd… but feel for you mate

          • Pakmann2k

            You are right. Had my moment on a soap box. Like I said, I still follow, just feel like I am clinging to something that isn’t there anymore. I can probably speak for many of the O.G. crowd that has left.
            Sent from my Verizon Wireless 4G LTE DROID

          • Blaine Harris

            had a droid inc o.g. and rooted it using a method where you had to have a specific sd card, pop it out at random intervals before recover booted, and go from there. took me two weeks to figure do it, and a week after they had a automated script… moved to a nexus galaxy to get what i had read so much about… let’s just say verizon didn’t stop me from having the latest… granted i typically stay on cm stables at this point… i still love tinkering now and then… Sent from my Verizon Wireless Galaxy Nexus w/ Kit Kat

      • JabbaMac

        Almost every site that talks about rooting and romming refers the reader back to XDA for details, so other than making us aware of whats going on it doesn’t make much sense for a site like this to try to duplicate XDA. I’ve noticed this shift away from nitty-gritty romming details at other sites as well. Also, any flashaholic is going to have XDA as their home base anyway.

  • grumpyfuzz

    does this get back ota updates?

  • jim

    ive had 8 gnex phones trying to get a good one, started in Dec 2011 to April 2012, well I was sent 6 refurbish and 2 new ones, so when I kept a one of the new ones, they changed my upgrade date to 4-4-2014 , and said I agreed to it, so I told them, write this down april 4 2014 I am the wife will be leaving , told them to kiss my ass

  • jim

    ever been screwed by a company and you didn’t find out about it for 2 years ? yep Verizon did it to me behind my back and I just found out

  • zmr333
  • Guest

    Anybody else notice something in this picture? Something with Android?

  • Guest

    Eh FYI: the tarball comes with scripts to do all the flashing for you… Only need to manually type the commands if you only want some of the images flashed.

  • Derin Richardson

    I don’t even bother with flash all scripts. Waste of time since they never work for me. I just flash everything manually anyway.

    Plus, I like to TWRP untouched.

    • Joseph Williams

      how is a script that is doing the exact same thing you’re doing, except without you doing it a waste of time? I’d think manually typing all these commands is a waste of time… provided you want to flash them all.

      • Derin Richardson

        I’m saying it is a waste of time for me personally because I can’t get it to work properly for whatever reason. Not that is a waste of time period.

        • Adrynalyne

          Were you using the flash-all.sh on Windows?


          • joder

            Go back to your mac mini terminal you supposed Apple hater.

          • Adrynalyne

            sh isn’t an Apple thing, j(tr)o(ll)der.

          • joder

            I see what you did there :p

            OS X uses Unix and Unix uses sh thus OS X uses sh.

          • Adrynalyne

            Newp. OS X is built upon XNU.


          • Dustin Klingele

            OSX is built upon NextSTEP which was XNU based. XNU is Unix based, but it’s a derivative of the base code which so ultimately, OSX is in a roundabout way Unix based.

    • Butters619

      Personally I like to run all the commands myself so if it messes up, I know where and I know how to fix it. If you lean on scripts, one day something is going to go wrong, and you are going to panic, and you are going to have to learn adb/fastboot with a soft bricked phone. Might as well take the time. Plus, it’s more rewarding.

    • mariarowles

      until I looked at
      the check for $8428, I be certain …that…my brother actually bringing in
      money in there spare time from there computar.. there aunt haz done this less
      than seventeen months and resantly paid for the mortgage on their house and
      bought a gorgeous Mazda MX-5. this is where I went, http://www.bar29.cℴℳ

    • NexusPhan


  • Dulan C. Swagwagon

    Might as well link Nexus 4 tutorials ~_~

    • sc0rch3d

      fastboot genius unlock

  • Colton

    why not use Roboto for those boot option menus?
    hashtag bothered -_-