How to flash the Android Marshmallow factory image on Nexus devices

Google Nexus 6P

Android Marshmallow is finally here, which means that Google will be rolling out the update to all Nexus devices. Unfortunately that could take several weeks, and we know that many of you are too impatient to wait.

Good news! Google has posted factory images for each Nexus device, so you can go ahead and update your device to Android 6.0 Marshmallow right now instead of waiting. We know this can be a little scary — especially for beginners — so that’s why we put together this comprehensive guide detailing each and every step of the way. You won’t find a more complete tutorial anywhere else.
Updated on 02-05-2016 by Robert Nazarian: Google released the February 2016 security patch in early February. You can still follow this guide to install that update on your Nexus device since the download link page remains the same. 

Flashing the factory image differs from installing the over-the-air (OTA) update in that the factory image contains the full system files for your device, whereas the OTA update contains only the upgrade information. In other words, flashing a factory image is more like completely deleting all the software on your device and replacing it. The OTA will only replace what is being changed since your last update.
Some people prefer to install the OTA update since you don’t have to do a factory reset, while others like the factory image method because it’s like starting from scratch with a fresh install of the entire system. It’s more of a pain to factory reset your device, but you are less prone to some of those annoying bugs that seem to crop up after an OTA update. If you would rather download and install the OTA update, we have a complete guide for that method as well.
*We will provide a link to this guide as soon as the OTA download links become available.
If you want to flash the factory image, then you’re already in the right place. Just remember to make sure all your data is backed up, because you will lose all your data on the device when you unlock the bootloader, which is required for flashing. There is no way to unlock a bootloader without a factory reset. However, if you happen to already have an unlocked bootloader, then you can forgo the factory reset if you wish. We will show you how later on, but we still recommend that you back up your data in case something goes wrong.