How to Erase ESP8266 NodeMCU Flash Memory (Factory Reset)

This quick article explains how to erase ESP8266 NodeMCU flash memory to restore it to its factory default settings. Using a tool named, we'll be able to communicate. If the system keeps crashing and you can't upload new code, if you want to remove any firmware or configuration modifications you made, if you want to clean off old data, or for other reasons, you may find it useful to restore ESP8266 to its factory settings.


We'll use esptool, which is a “Python-based, open-source, platform-independent utility to communicate with the ROM bootloader in Espressif chips,” to perform an ESP8266 factory reset.

You need Python 3.7 or newer installed on your system to install esptool. Make sure you choose the right package for your system before beginning the download and installation process at the following link:

Open a terminal window and use pip to install the latest stable release of the package when Python 3 is installed.

pip install esptool

Note: That command may not work in some Python installations, and you will receive an error. If this is the case, try installing using:

  • pip3 install esptool
  • python -m pip install esptool
  • pip2 install esptool

Setuptools is also a requirement that is not installed by default on all systems. You may use the following command to install it:

pip install setuptools

Read More: How to Flash NodeMCU Firmware on ESP8266 using Windows

You should be able to run with the command esptool after installation since it will be placed in the default Python executables directory. Run the following command from your terminal window:

python -m esptool

If it was installed properly, it should display a similar message (regardless of your operating system):

esptool arguments

Erasing ESP8266 NodeMCU Flash Memory

Follow the next steps to erase ESP8266 NodeMCU flash:

  1. Connect the ESP8266 board to your computer.
  2. Open a terminal window on your computer.
  3. Hold the ESP8266 BOOT/FLASH button.
esp8266 boot button
  1. Copy the following command to your terminal window and press Enter (continue holding the FLASH/BOOT button).

Read More: Build an ESP8266 Web Server: The Complete Guide

python -m esptool --chip esp8266 erase_flash
  1. You may release the “BOOT/FLASH” button after the “Erasing” process has begun. The ESP8266 flash memory will be deleted after a few seconds.
esptool erase flash esp8266

Note: If you keep seeing new dots after the “Connecting…” message, your ESP8266 board is not in flashing mode. To make sure that your ESP8266 enters flashing mode and properly completes the erasing process, you need to repeat all of the previously stated steps and hold the “BOOT/FLASH” button.

Oh hi there It’s nice to meet you.

Sign up to receive awesome content in your inbox, every month.

We don’t spam! Read our privacy policy for more info.

Leave a Reply

Your email address will not be published. Required fields are marked *

ESP8266 Home Automation Projects

Leverage the power of this tiny WiFi chip to build exciting smart home projects