[Nexus 7 (2013) General] RMarkwald:
DISCLAIMER: I am not responsible for what you do to your tablet. I've done these steps dozens of times without issue on Windows and Linux. PLEASE READ THIS ENTIRE THREAD FIRST TO UNDERSTAND IT BEFORE ACTUALLY PERFORMING THEM ON YOUR DEVICE!!!

This is done using the Android SDK, the command incorporated in that called fastboot. No toolkit, I don't do them, never have, so I cannot support anyone trying anything from a toolkit. Doing this process will take you from start to finish no more than two minutes.

I haven't seen a "How-To" on returning to 100% out-of-the-box stock using fastboot commands and Google's factory N7 2013 images. If I've overlooked this, I apologize in advance. I've seen a lot of people asking how to do this in the forums, so I thought this may help.

This will work on Linux or Windows. I use Windows 7 x64 for work, Linux Mint 15 x64 otherwise. With Linux you will need to add permissions for the USB device in /etc/udev/rules.d. I had to do this on my Linux Mint 15 x64 laptop, you may not. If you get an error stating something to the effect of "insufficient permissions...", you'll want to Google "android udev rules setup". I won't cover that here.

This guide should work for the LTE N7 2013, but I don't have one to test.

Before we begin, back up anything on your internal /sdcard partition you want saved.

This will 100% wipe your device to what it was when you first unboxed it.

I warned you. You'll be erasing everything, and it will be reloaded. Stock Android recovery will be loaded, and you will not be rooted.

What you'll need:

Android SDK - specifically fastboot working

Google factory images from here.

Unlocked Nexus 7 tablet

Here we go (this will be based off of the N7 2013 Wifi-only device, JSS15R image):

1. Extract from the compressed image from the .tgz/.tar, you'll want to extract the folder called razor-jss15r. Extract this folder to your SDK/platform-tools location. My SDK is on my C:\, so my path to it on Windows is C:\sdk\platform-tools. Linux it would be at /home/ryan/sdk/platform-tools. Once extracted, you should have a folder called: razor-jss15r. There should be 5 files in there, 1 is a zipped folder called image-razor-jss15r.zip. DON'T UNZIP IT!

2. Open command prompt, and change directories to your SDK/platform-tools location. Boot your tablet to the bootloader, and plug it into your computer. We're ready to issue commands now.

3. After each command, hit Enter. I'm not going to state that to make sure people don't get confused. Each line is it's own command. I recommend copy then pasting each command below, one by one, into the command prompt window.

fastboot erase boot

fastboot erase cache

fastboot erase recovery

fastboot erase system

fastboot erase userdata

fastboot flash bootloader razor-krt16o/bootloader-flo-flo-03.14.img

fastboot reboot-bootloader

fastboot -w update razor-krt16o/image-razor-krt16o.zip

NOTE: You can remove the -w in the above to prevent internal sdcard from getting wiped.

After the last command, the tablet will automatically reboot itself.

Go through setup, hook up the device to your computer and copy anything you'd like on your device, I recommend a SuperSU flashable zip if you want to root. Download a custom recovery image, and place it into your SDK\platform-tools folder. You can then boot back into the bootloader and flash the custom recovery of your choice (fastboot flash recovery recoveryfilename.img). At that point you can reboot into that custom recovery, and flash the SuperSU zip to have root. Reboot. Done.

Some of the commands may take up to 30 seconds or so, just let them run. The ones that will take that time are erasing system and userdata, and the last command will take time.

OPTIONAL:

If you want to re-lock your bootloader, which is usually ONLY done if you are returning for warranty purposes (and WILL erase your internal sdcard!), boot back to the bootloader and run:

fastboot oem lock